Cleanup most warnings

[?]
Sep 29, 2020, 12:42 PM
H3RWXT2VK4SMM754MZLJA5R5ZK7EHAKZN63ROSJ2V46DXDKEF7GAC

Dependencies

  • [2] 7WM64CI7 Implement all previous functionality
  • [3] OGMBXBKP Move online to XmppConnection
  • [4] 5WHNHD42 Update dependencies
  • [5] CCLGGFKR Move out XmppConnection into own file
  • [6] OB3HA2MD Use Client::new_with_jid to parse jid only once
  • [7] FWJDW3G5 Allow process xmpp incoming stanzas with futures
  • [8] HDLI2X4H Ignore delayed XEP-0203 messages
  • [9] PBRUH4BJ Rename optional XmppConnection to MaybeXmppConnection
  • [10] YEMBT7TB Add support for XEP-0092: Software Version
  • [11] Z3NQEYVI Rename IqSetHandler to IqResuestHandler as it should provide both get and set handling
  • [12] 4IPZTMFI Update dependencies
  • [13] OFLAP2G2 Fix possible utf8 errors
  • [14] FVVPKFTL Initial commit
  • [15] JY4F7VBC Use element processor for incoming iq set
  • [16] LNUU5R56 Support disco#info from XEP-0030 Service Discovery
  • [17] UIXIQHDY Wait for commands via new processing code
  • [18] RQZCVDFD Implement applying timeout for expired iq await
  • [19] LL3D5CXK Staring using element processor
  • [20] SH3LIQ4S Starting commands support
  • [21] 5IKA4GO7 Rename xmpp client field from "inner" to "client"
  • [22] IK3YDPTY Update deps
  • [23] CBWCXUZZ Prepare adding new items to roster
  • [24] ALP2YJIU Rename XmppState to XmppProcessState
  • [25] OANBCLN5 Move xmpp client into XmppState
  • [26] DYRPAV6T Update dependencies
  • [27] ZFBPXPAD Cleanup timeouted iq requests with ping Output elapsed time. Refactor iq handling.
  • [28] 6UKCVM6E Use new iq processng for initial roster
  • [29] KORYGY74 Set presence to account and MUC
  • [30] YTN366WA Support disco#items
  • [31] S754Y5DF Refactor IQ processing Always answer to set and get requests. Use XML encoding for stanzas.
  • [32] LQXBWNFT Remove unneeded requirement
  • [33] GXQCDLYQ Use element processor for incoming iq get
  • [34] UMTLHH77 Process commands in the separate function
  • [35] W6GSBP3Z Add id for presence stanzas
  • [36] NDDQQP2P Update deps
  • [37] AYQZ2UIA Update deps
  • [38] 5A5UVGNM Move receiver closing logic out of xmpp processing
  • [39] AEH7WP42 Make element processors static
  • [40] GVZ4JAR5 Process self-presence with incoming stanza processor
  • [41] WDCZNZOP Fix rustdoc
  • [42] BYJPYYSM Process iq ping response
  • [43] HU3NZX5Z Process self-presence via new processing code
  • [44] RGOSS73U Convert self-presence to xmpp_parser's type
  • [45] SSOKGGCE Update dependencies
  • [46] ZT3YEIVX Consume connection on processing command
  • [47] QDHDTOLM Starting support for commands XEP-0050: Ad-Hoc Commands (there no support in xmpp_parsers still)
  • [48] RRLRZTMR Use element processor for iq
  • [49] DCMDASHV Mention XEP-0050 and XEP-0203 support
  • [50] PJV5HPIF Starting to imlements timeouts for iqs
  • [51] SU4DNVCB Start to processing roster data
  • [52] U3UZTFCH Re-try to subscribe if not subscribed
  • [53] VS6AHRWI Move XMPP to separate dir
  • [54] 2THKW66M Ignore .orig files
  • [55] 3DSOPLCG Add rustdoc
  • [56] PLWPCM47 Add id to initital presence
  • [57] NXDEBFWR Switch to tokio 0.2 and async

Change contents

  • replacement in src/xmpp/xmpp_connection.rs at line 3
    [3.232][3.35:81]()
    use tokio_xmpp::{AsyncClient, Event, Packet};
    [3.232]
    [3.81]
    use tokio_xmpp::{AsyncClient, Event};
  • replacement in src/xmpp/xmpp_connection.rs at line 496
    [3.8559][3.8559:8602]()
    Err(account) => {}
    [3.8559]
    [3.8602]
    Err(_) => {}
  • edit in src/xmpp/xmpp_connection.rs at line 704
    [3.14932][3.13728:13772]()
    let account = self.account.clone();
  • replacement in src/xmpp/xmpp_connection.rs at line 746
    [3.15705][3.15705:15791]()
    Either::Left((stop, s)) => break (Ok(self), Either::Right(stop)),
    [3.15705]
    [3.15791]
    Either::Left((stop, _)) => break (Ok(self), Either::Right(stop)),
  • replacement in src/xmpp/xmpp_connection.rs at line 752
    [3.16029][3.16029:16089]()
    if (self.xmpp_processing(&event)) {
    [3.16029]
    [3.16089]
    if self.xmpp_processing(&event) {
  • replacement in src/xmpp/xmpp_connection.rs at line 841
    [3.18606][3.18606:18663]()
    Either::Left(((), send_future)) => None,
    [3.18606]
    [3.18663]
    Either::Left(((), _)) => None,
  • edit in src/xmpp/xmpp_connection.rs at line 1049
    [3.32872][3.20502:20528]()
    _ => todo!(),
  • replacement in src/xmpp/mod.rs at line 2
    [3.25146][3.25146:25176]()
    use log::{error, info, warn};
    [3.25146]
    [3.197]
    use log::{info, warn};
  • edit in src/xmpp/mod.rs at line 14
    [3.37174][3.60161:60162](),[3.29910][3.60161:60162](),[3.36071][3.60161:60162](),[3.60161][3.60161:60162](),[3.67188][3.38939:38971](),[3.40648][3.38939:38971](),[3.38971][3.86:103](),[3.5712][3.86:103](),[3.10311][3.86:103](),[3.3992][3.86:103](),[3.5899][3.86:103](),[3.6120][3.86:103](),[3.5503][3.86:103](),[3.40715][3.86:103](),[3.23318][3.86:103](),[3.4874][3.86:103](),[3.5895][3.86:103](),[3.86][3.86:103](),[3.103][3.3876:3891](),[3.3876][3.3876:3891](),[3.3891][3.38972:39003](),[3.39003][3.3917:3920](),[3.5772][3.3917:3920](),[3.40742][3.3917:3920](),[3.4053][3.3917:3920](),[3.5669][3.3917:3920](),[3.513][3.3917:3920](),[3.4821][3.3917:3920](),[3.12168][3.3917:3920](),[3.8775][3.3917:3920](),[3.3917][3.3917:3920](),[3.3920][3.39004:39157](),[3.39157][3.4058:4136](),[3.5866][3.4058:4136](),[3.10444][3.4058:4136](),[3.4125][3.4058:4136](),[3.6053][3.4058:4136](),[3.6253][3.4058:4136](),[3.5657][3.4058:4136](),[3.40870][3.4058:4136](),[3.23472][3.4058:4136](),[3.5007][3.4058:4136](),[3.6049][3.4058:4136](),[3.4058][3.4058:4136]()
    struct XmppProcessState<F, S> {
    cmd_recv: S,
    signal: F,
    conn: MaybeXmppConnection,
    }
    impl<F, S> XmppProcessState<F, S> {
    fn new(cmd_recv: S, signal: F, conn: MaybeXmppConnection) -> XmppProcessState<F, S> {
    XmppProcessState {
    cmd_recv,
    signal,
    conn,
    }
    }
    }
  • replacement in src/xmpp/mod.rs at line 36
    [3.25834][3.25834:25899]()
    (Ok(conn), Either::Right(None)) => break Ok(()),
    [3.25834]
    [3.25899]
    (Ok(_), Either::Right(None)) => break Ok(()),
  • replacement in src/xmpp/mod.rs at line 46
    [3.26288][3.26288:26353]()
    (Err(acc), Either::Right(None)) => break Ok(()),
    [3.26288]
    [3.26353]
    (Err(_), Either::Right(None)) => break Ok(()),
  • replacement in src/xmpp/element_processor.rs at line 0
    [3.11301][2.6275:7372]()
    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)
    }
    }
  • replacement in src/main.rs at line 110
    [2.7750][2.7750:7833]()
    .body(Body::from(format!("Cann't get presence text")))
    [2.7750]
    [2.7833]
    .body(Body::from(format!("Cann't get presence text: {}", e)))
  • replacement in src/main.rs at line 136
    [2.9183][2.9183:9262]()
    .body(Body::from(format!("Cann't get chat text")))
    [2.9183]
    [2.9262]
    .body(Body::from(format!("Cann't get chat text: {}", e)))
  • replacement in src/main.rs at line 169
    [3.31625][3.31625:31708](),[3.31625][3.31625:31708]()
    .body(Body::from(format!("Cann't get presence text")))
    [3.31625]
    [3.31708]
    .body(Body::from(format!("Cann't get presence text: {}", e)))
  • replacement in src/main.rs at line 198
    [2.11941][2.11941:12020]()
    .body(Body::from(format!("Cann't get chat text")))
    [2.11941]
    [2.12020]
    .body(Body::from(format!("Cann't get chat text: {}", e)))
  • replacement in src/main.rs at line 264
    [3.33699][3.33699:33738]()
    tokio::signal::ctrl_c().await;
    [3.33699]
    [3.33738]
    if let Err(e) = tokio::signal::ctrl_c().await {
    error!("Cann't wait for Ctrl+C: {}", e);
    }
  • replacement in src/main.rs at line 290
    [3.34435][3.34435:34581]()
    cmd_send.clone().send(XmppCommand::Ping).await;
    cmd_send.send(XmppCommand::TimeoutCleanup).await;
    [3.34435]
    [3.34581]
    if let Err(e) = cmd_send.clone().send(XmppCommand::Ping).await {
    error!("Cannot send ping command: {}", e);
    }
    if let Err(e) = cmd_send.send(XmppCommand::TimeoutCleanup).await {
    error!("Cann't send cleanup command: {}", e);
    }
  • replacement in src/main.rs at line 320
    [3.51270][3.35275:35298]()
    http_server.await;
    [3.51270]
    [3.51329]
    http_server.await?;
  • edit in src/main.rs at line 323
    [3.51359][3.51359:51360](),[3.51359][3.51359:51360](),[3.51360][3.35299:35330]()
    xmpp_join.join().unwrap();
  • replacement in src/main.rs at line 324
    [3.35331][3.35331:35342]()
    Ok(())
    [3.35331]
    [3.61]
    xmpp_join.join().expect("Join to xmpp thread")