From ab2d2db9875bbdaaef36f6ccf8a437cf6f2ce67f Mon Sep 17 00:00:00 2001 From: JT <547158+jntrnr@users.noreply.github.com> Date: Fri, 22 Oct 2021 06:57:51 +1300 Subject: [PATCH] Fix clippy warnings (#4088) * Fix clippy warnings * Fix clippy warnings --- crates/nu-plugin/src/plugin.rs | 5 ---- crates/nu_plugin_selector/src/tables.rs | 30 +++++++++++------------ crates/nu_plugin_textview/src/textview.rs | 2 +- 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/crates/nu-plugin/src/plugin.rs b/crates/nu-plugin/src/plugin.rs index 5ef6daa852..e764dbf72e 100644 --- a/crates/nu-plugin/src/plugin.rs +++ b/crates/nu-plugin/src/plugin.rs @@ -55,7 +55,6 @@ pub fn serve_plugin(plugin: &mut dyn Plugin) { match command { Ok(NuCommand::config) => { send_response(plugin.config()); - return; } Ok(NuCommand::begin_filter { params }) => { send_response(plugin.begin_filter(params)); @@ -65,23 +64,19 @@ pub fn serve_plugin(plugin: &mut dyn Plugin) { } Ok(NuCommand::end_filter) => { send_response(plugin.end_filter()); - return; } Ok(NuCommand::sink { params }) => { plugin.sink(params.0, params.1); - return; } Ok(NuCommand::quit) => { plugin.quit(); - return; } e => { send_response(ShellError::untagged_runtime_error(format!( "Could not handle plugin message: {} {:?}", input, e ))); - return; } } } diff --git a/crates/nu_plugin_selector/src/tables.rs b/crates/nu_plugin_selector/src/tables.rs index 06c03c180c..2b42c02ba1 100644 --- a/crates/nu_plugin_selector/src/tables.rs +++ b/crates/nu_plugin_selector/src/tables.rs @@ -343,23 +343,23 @@ mod tests { use indexmap::indexmap; use nu_protocol::UntaggedValue; - const TABLE_EMPTY: &'static str = r#" + const TABLE_EMPTY: &str = r#"
"#; - const TABLE_TH: &'static str = r#" + const TABLE_TH: &str = r#"
NameAge
"#; - const TABLE_TD: &'static str = r#" + const TABLE_TD: &str = r#"
NameAge
"#; - const TWO_TABLES_TD: &'static str = r#" + const TWO_TABLES_TD: &str = r#"
NameAge
@@ -368,14 +368,14 @@ mod tests { "#; - const TABLE_TH_TD: &'static str = r#" + const TABLE_TH_TD: &str = r#"
NameAge
John20
"#; - const TWO_TABLES_TH_TD: &'static str = r#" + const TWO_TABLES_TH_TD: &str = r#" @@ -386,21 +386,21 @@ mod tests {
NameAge
John20
"#; - const TABLE_TD_TD: &'static str = r#" + const TABLE_TD_TD: &str = r#"
NameAge
John20
"#; - const TABLE_TH_TH: &'static str = r#" + const TABLE_TH_TH: &str = r#"
NameAge
John20
"#; - const TABLE_COMPLEX: &'static str = r#" + const TABLE_COMPLEX: &str = r#" @@ -410,7 +410,7 @@ mod tests {
NameAgeExtra
John20
"#; - const TWO_TABLES_COMPLEX: &'static str = r#" + const TWO_TABLES_COMPLEX: &str = r#" foo @@ -433,7 +433,7 @@ mod tests { "#; - const HTML_NO_TABLE: &'static str = r#" + const HTML_NO_TABLE: &str = r#" foo @@ -441,7 +441,7 @@ mod tests { "#; - const HTML_TWO_TABLES: &'static str = r#" + const HTML_TWO_TABLES: &str = r#" foo @@ -458,7 +458,7 @@ mod tests { "#; - const HTML_TABLE_FRAGMENT: &'static str = r#" + const HTML_TABLE_FRAGMENT: &str = r#" @@ -467,7 +467,7 @@ mod tests { "#; - const HTML_TABLE_WIKIPEDIA_WITH_COLUMN_NAMES: &'static str = r#" + const HTML_TABLE_WIKIPEDIA_WITH_COLUMN_NAMES: &str = r#"
NameAge
John20
@@ -515,7 +515,7 @@ mod tests {
Excel 2007 formats
"#; - const HTML_TABLE_WIKIPEDIA_COLUMNS_AS_ROWS: &'static str = r#" + const HTML_TABLE_WIKIPEDIA_COLUMNS_AS_ROWS: &str = r#"
Microsoft Excel diff --git a/crates/nu_plugin_textview/src/textview.rs b/crates/nu_plugin_textview/src/textview.rs index 6ac9e1ef53..b96c0632a6 100644 --- a/crates/nu_plugin_textview/src/textview.rs +++ b/crates/nu_plugin_textview/src/textview.rs @@ -36,7 +36,7 @@ pub fn view_text_value(value: &Value) { let config = nu_data::config::config(Tag::unknown()) .ok() .and_then(|config| config.get("textview").map(Config::from)) - .unwrap_or_else(Config::default); + .unwrap_or_default(); if let UntaggedValue::Primitive(Primitive::String(ref s)) = &value.value { let mut printer = bat::PrettyPrinter::new();