Fix clippy warnings (#4088)

* Fix clippy warnings

* Fix clippy warnings
This commit is contained in:
JT 2021-10-22 06:57:51 +13:00 committed by GitHub
parent 07e05ef183
commit ab2d2db987
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 21 deletions

View File

@ -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;
}
}
}

View File

@ -343,23 +343,23 @@ mod tests {
use indexmap::indexmap;
use nu_protocol::UntaggedValue;
const TABLE_EMPTY: &'static str = r#"
const TABLE_EMPTY: &str = r#"
<table></table>
"#;
const TABLE_TH: &'static str = r#"
const TABLE_TH: &str = r#"
<table>
<tr><th>Name</th><th>Age</th></tr>
</table>
"#;
const TABLE_TD: &'static str = r#"
const TABLE_TD: &str = r#"
<table>
<tr><td>Name</td><td>Age</td></tr>
</table>
"#;
const TWO_TABLES_TD: &'static str = r#"
const TWO_TABLES_TD: &str = r#"
<table>
<tr><td>Name</td><td>Age</td></tr>
</table>
@ -368,14 +368,14 @@ mod tests {
</table>
"#;
const TABLE_TH_TD: &'static str = r#"
const TABLE_TH_TD: &str = r#"
<table>
<tr><th>Name</th><th>Age</th></tr>
<tr><td>John</td><td>20</td></tr>
</table>
"#;
const TWO_TABLES_TH_TD: &'static str = r#"
const TWO_TABLES_TH_TD: &str = r#"
<table>
<tr><th>Name</th><th>Age</th></tr>
<tr><td>John</td><td>20</td></tr>
@ -386,21 +386,21 @@ mod tests {
</table>
"#;
const TABLE_TD_TD: &'static str = r#"
const TABLE_TD_TD: &str = r#"
<table>
<tr><td>Name</td><td>Age</td></tr>
<tr><td>John</td><td>20</td></tr>
</table>
"#;
const TABLE_TH_TH: &'static str = r#"
const TABLE_TH_TH: &str = r#"
<table>
<tr><th>Name</th><th>Age</th></tr>
<tr><th>John</th><th>20</th></tr>
</table>
"#;
const TABLE_COMPLEX: &'static str = r#"
const TABLE_COMPLEX: &str = r#"
<table>
<tr><th>Name</th><th>Age</th><th>Extra</th></tr>
<tr><td>John</td><td>20</td></tr>
@ -410,7 +410,7 @@ mod tests {
</table>
"#;
const TWO_TABLES_COMPLEX: &'static str = r#"
const TWO_TABLES_COMPLEX: &str = r#"
<!doctype HTML>
<html>
<head><title>foo</title></head>
@ -433,7 +433,7 @@ mod tests {
</html>
"#;
const HTML_NO_TABLE: &'static str = r#"
const HTML_NO_TABLE: &str = r#"
<!doctype HTML>
<html>
<head><title>foo</title></head>
@ -441,7 +441,7 @@ mod tests {
</html>
"#;
const HTML_TWO_TABLES: &'static str = r#"
const HTML_TWO_TABLES: &str = r#"
<!doctype HTML>
<html>
<head><title>foo</title></head>
@ -458,7 +458,7 @@ mod tests {
</html>
"#;
const HTML_TABLE_FRAGMENT: &'static str = r#"
const HTML_TABLE_FRAGMENT: &str = r#"
<table id="first">
<tr><th>Name</th><th>Age</th></tr>
<tr><td>John</td><td>20</td></tr>
@ -467,7 +467,7 @@ mod tests {
</html>
"#;
const HTML_TABLE_WIKIPEDIA_WITH_COLUMN_NAMES: &'static str = r#"
const HTML_TABLE_WIKIPEDIA_WITH_COLUMN_NAMES: &str = r#"
<table class="wikitable">
<caption>Excel 2007 formats
</caption>
@ -515,7 +515,7 @@ mod tests {
</td></tr></tbody></table>
"#;
const HTML_TABLE_WIKIPEDIA_COLUMNS_AS_ROWS: &'static str = r#"
const HTML_TABLE_WIKIPEDIA_COLUMNS_AS_ROWS: &str = r#"
<table class="infobox vevent">
<caption class="infobox-title summary">
Microsoft Excel

View File

@ -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();