Fix most clippy warnings

[?]
Sep 29, 2020, 12:48 PM
F5E5NQPABQW6TXEHI7SH5ZSHEXYBOO5QW6XETXMTXLWLTCTTE2BAC

Dependencies

  • [2] H3RWXT2V Cleanup most warnings
  • [3] ZT3YEIVX Consume connection on processing command
  • [4] RRLRZTMR Use element processor for iq
  • [5] 7WM64CI7 Implement all previous functionality
  • [6] LL3D5CXK Staring using element processor
  • [7] LQXBWNFT Remove unneeded requirement
  • [8] GXQCDLYQ Use element processor for incoming iq get
  • [9] 3DSOPLCG Add rustdoc
  • [10] BYJPYYSM Process iq ping response
  • [11] PJV5HPIF Starting to imlements timeouts for iqs
  • [12] GVZ4JAR5 Process self-presence with incoming stanza processor
  • [13] SH3LIQ4S Starting commands support
  • [14] 2THKW66M Ignore .orig files
  • [15] HDLI2X4H Ignore delayed XEP-0203 messages
  • [16] 5WHNHD42 Update dependencies
  • [17] KORYGY74 Set presence to account and MUC
  • [18] AEH7WP42 Make element processors static
  • [19] PLWPCM47 Add id to initital presence
  • [20] LNUU5R56 Support disco#info from XEP-0030 Service Discovery
  • [21] OFLAP2G2 Fix possible utf8 errors
  • [22] ZFBPXPAD Cleanup timeouted iq requests with ping Output elapsed time. Refactor iq handling.
  • [23] QDHDTOLM Starting support for commands XEP-0050: Ad-Hoc Commands (there no support in xmpp_parsers still)
  • [24] CCLGGFKR Move out XmppConnection into own file
  • [25] YTN366WA Support disco#items
  • [26] U3UZTFCH Re-try to subscribe if not subscribed
  • [27] Z3NQEYVI Rename IqSetHandler to IqResuestHandler as it should provide both get and set handling
  • [28] NXDEBFWR Switch to tokio 0.2 and async
  • [29] W6GSBP3Z Add id for presence stanzas
  • [30] DCMDASHV Mention XEP-0050 and XEP-0203 support
  • [31] WDCZNZOP Fix rustdoc
  • [32] RQZCVDFD Implement applying timeout for expired iq await
  • [33] YEMBT7TB Add support for XEP-0092: Software Version
  • [34] 4IPZTMFI Update dependencies
  • [35] JY4F7VBC Use element processor for incoming iq set
  • [36] 6UKCVM6E Use new iq processng for initial roster
  • [37] SSOKGGCE Update dependencies
  • [38] S754Y5DF Refactor IQ processing Always answer to set and get requests. Use XML encoding for stanzas.
  • [39] DYRPAV6T Update dependencies
  • [*] FVVPKFTL Initial commit

Change contents

  • replacement in src/xmpp/xmpp_connection.rs at line 494
    [3.8411][3.8411:8559](),[3.8559][2.39:76](),[2.76][3.8602:8625](),[3.8602][3.8602:8625]()
    Either::Right(((result, Either::Left(_)), _)) => match result {
    Ok(connection) => break Ok(connection),
    Err(_) => {}
    },
    [3.8411]
    [3.8625]
    Either::Right(((result, Either::Left(_)), _)) => {
    if let Ok(connection) = result {
    break Ok(connection);
    }
    }
  • replacement in src/xmpp/element_processor.rs at line 0
    [3.11301][2.422:1519]()
    type Func<S, T, E> = dyn Fn(&mut S, E) -> T + Sync;
    pub struct Processor<S: 'static, T: 'static, E: Clone + 'static> {
    processors: Vec<Box<Func<S, Option<T>, E>>>,
    default: &'static Func<S, T, E>,
    }
    impl<S: 'static, T: 'static, E: Clone + 'static> Processor<S, T, E> {
    pub fn new<F>(f: &'static F) -> Processor<S, T, E>
    where
    F: Fn(&mut S, E) -> T + Sync + 'static,
    {
    Processor {
    processors: vec![],
    default: f,
    }
    }
    pub fn register<F, A>(&mut self, f: &'static F)
    where
    F: Fn(&mut S, A) -> T + Sync + 'static,
    A: std::convert::TryFrom<E>,
    {
    self.processors.push(Box::new(move |s, e: E| {
    use std::convert::TryInto;
    (e.try_into().ok() as Option<A>).map(|a| f(s, a))
    }));
    }
    pub fn process(&self, s: &mut S, e: E) -> T {
    for processor in self.processors.iter() {
    match processor(s, e.clone()) {
    Some(t) => return t,
    None => continue,
    }
    }
    (*self.default)(s, e)
    }
    }
    [3.11301]
    type Func<S, T, E> = dyn Fn(&mut S, E) -> T + Sync;
    pub struct Processor<S: 'static, T: 'static, E: Clone + 'static> {
    processors: Vec<Box<Func<S, Option<T>, E>>>,
    default: &'static Func<S, T, E>,
    }
    impl<S: 'static, T: 'static, E: Clone + 'static> Processor<S, T, E> {
    pub fn new<F>(f: &'static F) -> Processor<S, T, E>
    where
    F: Fn(&mut S, E) -> T + Sync + 'static,
    {
    Processor {
    processors: vec![],
    default: f,
    }
    }
    pub fn register<F, A>(&mut self, f: &'static F)
    where
    F: Fn(&mut S, A) -> T + Sync + 'static,
    A: std::convert::TryFrom<E>,
    {
    self.processors.push(Box::new(move |s, e: E| {
    use std::convert::TryInto;
    (e.try_into().ok() as Option<A>).map(|a| f(s, a))
    }));
    }
    pub fn process(&self, s: &mut S, e: E) -> T {
    for processor in self.processors.iter() {
    match processor(s, e.clone()) {
    Some(t) => return t,
    None => continue,
    }
    }
    (*self.default)(s, e)
    }
    }
  • edit in src/main.rs at line 34
    [3.44840]
    [3.29248]
    #[allow(clippy::type_complexity)]
  • replacement in src/main.rs at line 98
    [3.30833][3.30833:30908]()
    .body(Body::from(format!("Accepted")))
    [3.30833]
    [3.30908]
    .body(Body::from("Accepted".to_string()))
  • replacement in src/main.rs at line 104
    [3.31243][3.7373:7463]()
    .body(Body::from(format!("Cann't send command")))
    [3.31243]
    [3.7463]
    .body(Body::from("Cann't send command".to_string()))
  • replacement in src/main.rs at line 124
    [3.8400][3.8400:8475](),[3.8400][3.8400:8475]()
    .body(Body::from(format!("Accepted")))
    [3.8400]
    [3.8475]
    .body(Body::from("Accepted".to_string()))
  • replacement in src/main.rs at line 130
    [3.8806][3.8806:8896](),[3.8806][3.8806:8896]()
    .body(Body::from(format!("Cann't send command")))
    [3.8806]
    [3.8896]
    .body(Body::from("Cann't send command".to_string()))
  • replacement in src/main.rs at line 157
    [3.10098][3.10098:10173](),[3.10098][3.10098:10173]()
    .body(Body::from(format!("Accepted")))
    [3.10098]
    [3.10173]
    .body(Body::from("Accepted".to_string()))
  • replacement in src/main.rs at line 163
    [3.10512][3.10512:10602](),[3.10512][3.10512:10602]()
    .body(Body::from(format!("Cann't send command")))
    [3.10512]
    [3.31338]
    .body(Body::from("Cann't send command".to_string()))
  • replacement in src/main.rs at line 186
    [3.11154][3.11154:11229]()
    .body(Body::from(format!("Accepted")))
    [3.11154]
    [3.11229]
    .body(Body::from("Accepted".to_string()))
  • replacement in src/main.rs at line 192
    [3.11564][3.11564:11654]()
    .body(Body::from(format!("Cann't send command")))
    [3.11564]
    [3.11654]
    .body(Body::from("Cann't send command".to_string()))
  • edit in src/main.rs at line 224
    [3.51215]
    [3.33057]
    #[allow(clippy::type_complexity)]