forked from extern/nushell
Clippy fixes for Rust 1.58 (#733)
* Clippy fixes for Rust 1.58 * Try different message
This commit is contained in:
parent
1ecbebb24a
commit
bc1e1aa944
@ -196,7 +196,7 @@ impl NuDataFrame {
|
||||
let df_new = DataFrame::new(new_cols).map_err(|e| {
|
||||
ShellError::SpannedLabeledError(
|
||||
"Error appending dataframe".into(),
|
||||
format!("Unable to append dataframes: {}", e.to_string()),
|
||||
format!("Unable to append dataframes: {}", e),
|
||||
span,
|
||||
)
|
||||
})?;
|
||||
|
@ -162,7 +162,7 @@ fn process_row(
|
||||
}
|
||||
} else {
|
||||
let mut obj = input.clone();
|
||||
for column in column_paths.clone() {
|
||||
for column in column_paths {
|
||||
let path = column.into_string();
|
||||
let data = input.get_data_by_key(&path);
|
||||
let is_empty = match data {
|
||||
|
@ -153,7 +153,7 @@ fn flat_value(columns: &[CellPath], item: &Value, _name_tag: Span) -> Vec<Value>
|
||||
|
||||
for (k, v) in cols.into_iter().zip(vals.into_iter()) {
|
||||
if out.contains_key(&k) {
|
||||
out.insert(format!("{}_{}", column.to_string(), k), v.clone());
|
||||
out.insert(format!("{}_{}", column, k), v.clone());
|
||||
} else {
|
||||
out.insert(k, v.clone());
|
||||
}
|
||||
|
@ -389,7 +389,7 @@ Format: #
|
||||
"attr" => nu_style.attr = Some(v.as_string()?),
|
||||
_ => {
|
||||
return Err(ShellError::IncompatibleParametersSingle(
|
||||
format!("problem with key: {}", k.to_string()),
|
||||
format!("problem with key: {}", k),
|
||||
code.span().expect("error with span"),
|
||||
))
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ fn action(
|
||||
}
|
||||
}
|
||||
other => {
|
||||
let got = format!("value is {}, not string", other.get_type().to_string());
|
||||
let got = format!("value is {}, not string", other.get_type());
|
||||
|
||||
Value::Error {
|
||||
error: ShellError::TypeMismatch(got, other.span().unwrap_or(*command_span)),
|
||||
|
@ -90,7 +90,7 @@ fn action(input: &Value, command_span: &Span) -> Value {
|
||||
Value::string(stripped_string, *span)
|
||||
}
|
||||
other => {
|
||||
let got = format!("value is {}, not string", other.get_type().to_string());
|
||||
let got = format!("value is {}, not string", other.get_type());
|
||||
|
||||
Value::Error {
|
||||
error: ShellError::TypeMismatch(got, other.span().unwrap_or(*command_span)),
|
||||
|
@ -111,7 +111,7 @@ impl Command for Kill {
|
||||
}
|
||||
cmd.arg("-9");
|
||||
} else if let Some(signal_value) = signal {
|
||||
cmd.arg(format!("-{}", signal_value.item.to_string()));
|
||||
cmd.arg(format!("-{}", signal_value.item));
|
||||
}
|
||||
|
||||
cmd.arg(pid.to_string());
|
||||
|
@ -193,11 +193,7 @@ fn create_grid_output(
|
||||
.unwrap_or_default();
|
||||
// eprintln!("ansi_style: {:?}", &ansi_style);
|
||||
|
||||
let item = format!(
|
||||
"{} {}",
|
||||
icon_style.apply(icon).to_string(),
|
||||
ansi_style.apply(value).to_string()
|
||||
);
|
||||
let item = format!("{} {}", icon_style.apply(icon), ansi_style.apply(value));
|
||||
|
||||
let mut cell = Cell::from(item);
|
||||
cell.alignment = Alignment::Left;
|
||||
|
@ -44,7 +44,7 @@ impl Display for Type {
|
||||
"record<{}>",
|
||||
fields
|
||||
.iter()
|
||||
.map(|(x, y)| format!("{}: {}", x, y.to_string()))
|
||||
.map(|(x, y)| format!("{}: {}", x, y))
|
||||
.collect::<Vec<String>>()
|
||||
.join(", "),
|
||||
),
|
||||
|
@ -92,11 +92,7 @@ impl Inc {
|
||||
x => {
|
||||
let msg = x.as_string().map_err(|e| LabeledError {
|
||||
label: "Unable to extract string".into(),
|
||||
msg: format!(
|
||||
"value cannot be converted to string {:?} - {}",
|
||||
x,
|
||||
e.to_string()
|
||||
),
|
||||
msg: format!("value cannot be converted to string {:?} - {}", x, e),
|
||||
span: Some(head),
|
||||
})?;
|
||||
|
||||
|
@ -76,7 +76,7 @@ pub fn fail_test(input: &str, expected: &str) -> TestResult {
|
||||
#[cfg(test)]
|
||||
pub fn not_found_msg() -> &'static str {
|
||||
if cfg!(windows) {
|
||||
"cannot find"
|
||||
"not found"
|
||||
} else {
|
||||
"No such"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user