clippy --fix
This commit is contained in:
		@@ -76,7 +76,6 @@ impl ClientApiConnection {
 | 
			
		||||
        };
 | 
			
		||||
        if let Err(e) = reply_channel.send_async(response).await {
 | 
			
		||||
            error!("failed to process reply: {}", e);
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -248,7 +248,6 @@ Server Debug Commands:
 | 
			
		||||
                _ => {
 | 
			
		||||
                    ui.add_node_event(Level::Error, format!("unknown flag: {}", flag));
 | 
			
		||||
                    ui.send_callback(callback);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
@@ -271,7 +270,6 @@ Server Debug Commands:
 | 
			
		||||
                _ => {
 | 
			
		||||
                    ui.add_node_event(Level::Error, format!("unknown flag: {}", flag));
 | 
			
		||||
                    ui.send_callback(callback);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
@@ -399,12 +397,12 @@ Server Debug Commands:
 | 
			
		||||
    }
 | 
			
		||||
    pub fn update_route(&self, route: &json::JsonValue) {
 | 
			
		||||
        let mut out = String::new();
 | 
			
		||||
        if route["dead_routes"].len() != 0 {
 | 
			
		||||
        if !route["dead_routes"].is_empty() {
 | 
			
		||||
            out.push_str(&format!("Dead routes: {:?}", route["dead_routes"]));
 | 
			
		||||
        }
 | 
			
		||||
        if route["dead_routes"].len() != 0 {
 | 
			
		||||
        if !route["dead_routes"].is_empty() {
 | 
			
		||||
            if !out.is_empty() {
 | 
			
		||||
                out.push_str("\n");
 | 
			
		||||
                out.push('\n');
 | 
			
		||||
            }
 | 
			
		||||
            out.push_str(&format!(
 | 
			
		||||
                "Dead remote routes: {:?}",
 | 
			
		||||
@@ -460,7 +458,7 @@ Server Debug Commands:
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        let strmsg = if printable {
 | 
			
		||||
            format!("\"{}\"", String::from_utf8_lossy(&message).to_string())
 | 
			
		||||
            format!("\"{}\"", String::from_utf8_lossy(message))
 | 
			
		||||
        } else {
 | 
			
		||||
            hex::encode(message)
 | 
			
		||||
        };
 | 
			
		||||
@@ -498,7 +496,7 @@ Server Debug Commands:
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        let strmsg = if printable {
 | 
			
		||||
            format!("\"{}\"", String::from_utf8_lossy(&message).to_string())
 | 
			
		||||
            format!("\"{}\"", String::from_utf8_lossy(message))
 | 
			
		||||
        } else {
 | 
			
		||||
            hex::encode(message)
 | 
			
		||||
        };
 | 
			
		||||
 
 | 
			
		||||
@@ -58,7 +58,7 @@ fn main() -> Result<(), String> {
 | 
			
		||||
        None
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    let mut settings = settings::Settings::new(settings_path.as_ref().map(|x| x.as_os_str()))
 | 
			
		||||
    let mut settings = settings::Settings::new(settings_path.as_deref())
 | 
			
		||||
        .map_err(|e| format!("configuration is invalid: {}", e))?;
 | 
			
		||||
 | 
			
		||||
    // Set config from command line
 | 
			
		||||
 
 | 
			
		||||
@@ -58,7 +58,7 @@ impl TableViewItem<PeerTableColumn> for json::JsonValue {
 | 
			
		||||
            PeerTableColumn::NodeId => self["node_ids"][0].to_string(),
 | 
			
		||||
            PeerTableColumn::Address => self["peer_address"].to_string(),
 | 
			
		||||
            PeerTableColumn::LatencyAvg => {
 | 
			
		||||
                format!("{}", format_ts(&self["peer_stats"]["latency"]["average"]))
 | 
			
		||||
                format_ts(&self["peer_stats"]["latency"]["average"]).to_string()
 | 
			
		||||
            }
 | 
			
		||||
            PeerTableColumn::TransferDownAvg => {
 | 
			
		||||
                format_bps(&self["peer_stats"]["transfer"]["down"]["average"])
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@ use std::net::{SocketAddr, ToSocketAddrs};
 | 
			
		||||
use std::path::{Path, PathBuf};
 | 
			
		||||
 | 
			
		||||
pub fn load_default_config() -> Result<config::Config, config::ConfigError> {
 | 
			
		||||
    let default_config = r###"---
 | 
			
		||||
    let default_config = r#"---
 | 
			
		||||
address: "localhost:5959"
 | 
			
		||||
autoconnect: true
 | 
			
		||||
autoreconnect: true
 | 
			
		||||
@@ -44,7 +44,7 @@ interface:
 | 
			
		||||
            info               : "white"
 | 
			
		||||
            warn               : "light yellow"
 | 
			
		||||
            error              : "light red"
 | 
			
		||||
    "###
 | 
			
		||||
    "#
 | 
			
		||||
    .replace(
 | 
			
		||||
        "%LOGGING_FILE_DIRECTORY%",
 | 
			
		||||
        &Settings::get_default_log_directory().to_string_lossy(),
 | 
			
		||||
 
 | 
			
		||||
@@ -469,7 +469,7 @@ impl UI {
 | 
			
		||||
                let color = *Self::inner_mut(s).log_colors.get(&Level::Warn).unwrap();
 | 
			
		||||
                cursive_flexi_logger_view::parse_lines_to_log(
 | 
			
		||||
                    color.into(),
 | 
			
		||||
                    format!(">> Could not copy to clipboard"),
 | 
			
		||||
                    ">> Could not copy to clipboard".to_string(),
 | 
			
		||||
                );
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
@@ -482,15 +482,12 @@ impl UI {
 | 
			
		||||
                    )
 | 
			
		||||
                    .as_bytes(),
 | 
			
		||||
                )
 | 
			
		||||
                .is_ok()
 | 
			
		||||
            {
 | 
			
		||||
                if std::io::stdout().flush().is_ok() {
 | 
			
		||||
                    let color = *Self::inner_mut(s).log_colors.get(&Level::Info).unwrap();
 | 
			
		||||
                    cursive_flexi_logger_view::parse_lines_to_log(
 | 
			
		||||
                        color.into(),
 | 
			
		||||
                        format!(">> Copied: {}", text.as_ref()),
 | 
			
		||||
                    );
 | 
			
		||||
                }
 | 
			
		||||
                .is_ok() && std::io::stdout().flush().is_ok() {
 | 
			
		||||
                let color = *Self::inner_mut(s).log_colors.get(&Level::Info).unwrap();
 | 
			
		||||
                cursive_flexi_logger_view::parse_lines_to_log(
 | 
			
		||||
                    color.into(),
 | 
			
		||||
                    format!(">> Copied: {}", text.as_ref()),
 | 
			
		||||
                );
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@@ -523,7 +520,7 @@ impl UI {
 | 
			
		||||
        let mut reset: bool = false;
 | 
			
		||||
        match state {
 | 
			
		||||
            ConnectionState::Disconnected => {
 | 
			
		||||
                if inner.connection_dialog_state == None
 | 
			
		||||
                if inner.connection_dialog_state.is_none()
 | 
			
		||||
                    || inner
 | 
			
		||||
                        .connection_dialog_state
 | 
			
		||||
                        .as_ref()
 | 
			
		||||
@@ -541,7 +538,7 @@ impl UI {
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            ConnectionState::Connected(_, _) => {
 | 
			
		||||
                if inner.connection_dialog_state != None
 | 
			
		||||
                if inner.connection_dialog_state.is_some()
 | 
			
		||||
                    && !inner
 | 
			
		||||
                        .connection_dialog_state
 | 
			
		||||
                        .as_ref()
 | 
			
		||||
@@ -552,7 +549,7 @@ impl UI {
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            ConnectionState::Retrying(_, _) => {
 | 
			
		||||
                if inner.connection_dialog_state == None
 | 
			
		||||
                if inner.connection_dialog_state.is_none()
 | 
			
		||||
                    || inner
 | 
			
		||||
                        .connection_dialog_state
 | 
			
		||||
                        .as_ref()
 | 
			
		||||
@@ -1020,7 +1017,7 @@ impl UISender {
 | 
			
		||||
        for l in 0..node_ids.len() {
 | 
			
		||||
            let nid = &node_ids[l];
 | 
			
		||||
            if !node_id_str.is_empty() {
 | 
			
		||||
                node_id_str.push_str(" ");
 | 
			
		||||
                node_id_str.push(' ');
 | 
			
		||||
            }
 | 
			
		||||
            node_id_str.push_str(nid.to_string().as_ref());
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user