mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
Address lints from clippy for beta/nightly (#5709)
* Fix clippy lints in tests * Replace `format!` in `.push_str()` with `write!` Stylistically that might be a bit rough but elides an allocation. Fallibility of allocation is more explicit, but ignored with `let _ =` like in the clippy example: https://rust-lang.github.io/rust-clippy/master/index.html#format_push_string * Remove unused lifetime * Fix macro crate relative import * Derive `Eq` for `PartialEq` with `Eq` members https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq * Remove unnnecessary `.to_string()` for Cow<str> * Remove `.to_string()` for `tendril::Tendril` Implements `Deref<Target = str>`
This commit is contained in:
committed by
GitHub
parent
a82fa75c31
commit
e5d38dcff6
@ -4,6 +4,7 @@ use crate::query_xml::execute_xpath_query;
|
||||
use nu_engine::documentation::get_flags_section;
|
||||
use nu_plugin::{EvaluatedCall, LabeledError, Plugin};
|
||||
use nu_protocol::{Signature, Spanned, Value};
|
||||
use std::fmt::Write;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct Query;
|
||||
@ -59,15 +60,15 @@ impl Query {
|
||||
|
||||
pub fn get_brief_subcommand_help(sigs: &[Signature]) -> String {
|
||||
let mut help = String::new();
|
||||
help.push_str(&format!("{}\n\n", sigs[0].usage));
|
||||
help.push_str(&format!("Usage:\n > {}\n\n", sigs[0].name));
|
||||
let _ = write!(help, "{}\n\n", sigs[0].usage);
|
||||
let _ = write!(help, "Usage:\n > {}\n\n", sigs[0].name);
|
||||
help.push_str("Subcommands:\n");
|
||||
|
||||
for x in sigs.iter().enumerate() {
|
||||
if x.0 == 0 {
|
||||
continue;
|
||||
}
|
||||
help.push_str(&format!(" {} - {}\n", x.1.name, x.1.usage));
|
||||
let _ = writeln!(help, " {} - {}", x.1.name, x.1.usage);
|
||||
}
|
||||
|
||||
help.push_str(&get_flags_section(&sigs[0]));
|
||||
|
@ -294,7 +294,7 @@ fn cell_content(element: ElementRef) -> String {
|
||||
let frag = Html::parse_fragment(&element);
|
||||
for node in frag.tree {
|
||||
if let scraper::node::Node::Text(text) = node {
|
||||
dehtmlize.push_str(&text.text.to_string())
|
||||
dehtmlize.push_str(&text.text)
|
||||
}
|
||||
}
|
||||
|
||||
@ -314,7 +314,7 @@ fn contains_str(slice: &[String], item: &str) -> bool {
|
||||
let frag = Html::parse_fragment(item);
|
||||
for node in frag.tree {
|
||||
if let scraper::node::Node::Text(text) = node {
|
||||
dehtmlized.push_str(&text.text.to_string());
|
||||
dehtmlized.push_str(&text.text);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user