mirror of
https://github.com/nushell/nushell.git
synced 2024-11-29 03:44:19 +01:00
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| {
|
let df_new = DataFrame::new(new_cols).map_err(|e| {
|
||||||
ShellError::SpannedLabeledError(
|
ShellError::SpannedLabeledError(
|
||||||
"Error appending dataframe".into(),
|
"Error appending dataframe".into(),
|
||||||
format!("Unable to append dataframes: {}", e.to_string()),
|
format!("Unable to append dataframes: {}", e),
|
||||||
span,
|
span,
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
|
@ -162,7 +162,7 @@ fn process_row(
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let mut obj = input.clone();
|
let mut obj = input.clone();
|
||||||
for column in column_paths.clone() {
|
for column in column_paths {
|
||||||
let path = column.into_string();
|
let path = column.into_string();
|
||||||
let data = input.get_data_by_key(&path);
|
let data = input.get_data_by_key(&path);
|
||||||
let is_empty = match data {
|
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()) {
|
for (k, v) in cols.into_iter().zip(vals.into_iter()) {
|
||||||
if out.contains_key(&k) {
|
if out.contains_key(&k) {
|
||||||
out.insert(format!("{}_{}", column.to_string(), k), v.clone());
|
out.insert(format!("{}_{}", column, k), v.clone());
|
||||||
} else {
|
} else {
|
||||||
out.insert(k, v.clone());
|
out.insert(k, v.clone());
|
||||||
}
|
}
|
||||||
|
@ -389,7 +389,7 @@ Format: #
|
|||||||
"attr" => nu_style.attr = Some(v.as_string()?),
|
"attr" => nu_style.attr = Some(v.as_string()?),
|
||||||
_ => {
|
_ => {
|
||||||
return Err(ShellError::IncompatibleParametersSingle(
|
return Err(ShellError::IncompatibleParametersSingle(
|
||||||
format!("problem with key: {}", k.to_string()),
|
format!("problem with key: {}", k),
|
||||||
code.span().expect("error with span"),
|
code.span().expect("error with span"),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
@ -275,7 +275,7 @@ fn action(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
other => {
|
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 {
|
Value::Error {
|
||||||
error: ShellError::TypeMismatch(got, other.span().unwrap_or(*command_span)),
|
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)
|
Value::string(stripped_string, *span)
|
||||||
}
|
}
|
||||||
other => {
|
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 {
|
Value::Error {
|
||||||
error: ShellError::TypeMismatch(got, other.span().unwrap_or(*command_span)),
|
error: ShellError::TypeMismatch(got, other.span().unwrap_or(*command_span)),
|
||||||
|
@ -111,7 +111,7 @@ impl Command for Kill {
|
|||||||
}
|
}
|
||||||
cmd.arg("-9");
|
cmd.arg("-9");
|
||||||
} else if let Some(signal_value) = signal {
|
} 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());
|
cmd.arg(pid.to_string());
|
||||||
|
@ -193,11 +193,7 @@ fn create_grid_output(
|
|||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
// eprintln!("ansi_style: {:?}", &ansi_style);
|
// eprintln!("ansi_style: {:?}", &ansi_style);
|
||||||
|
|
||||||
let item = format!(
|
let item = format!("{} {}", icon_style.apply(icon), ansi_style.apply(value));
|
||||||
"{} {}",
|
|
||||||
icon_style.apply(icon).to_string(),
|
|
||||||
ansi_style.apply(value).to_string()
|
|
||||||
);
|
|
||||||
|
|
||||||
let mut cell = Cell::from(item);
|
let mut cell = Cell::from(item);
|
||||||
cell.alignment = Alignment::Left;
|
cell.alignment = Alignment::Left;
|
||||||
|
@ -44,7 +44,7 @@ impl Display for Type {
|
|||||||
"record<{}>",
|
"record<{}>",
|
||||||
fields
|
fields
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(x, y)| format!("{}: {}", x, y.to_string()))
|
.map(|(x, y)| format!("{}: {}", x, y))
|
||||||
.collect::<Vec<String>>()
|
.collect::<Vec<String>>()
|
||||||
.join(", "),
|
.join(", "),
|
||||||
),
|
),
|
||||||
|
@ -92,11 +92,7 @@ impl Inc {
|
|||||||
x => {
|
x => {
|
||||||
let msg = x.as_string().map_err(|e| LabeledError {
|
let msg = x.as_string().map_err(|e| LabeledError {
|
||||||
label: "Unable to extract string".into(),
|
label: "Unable to extract string".into(),
|
||||||
msg: format!(
|
msg: format!("value cannot be converted to string {:?} - {}", x, e),
|
||||||
"value cannot be converted to string {:?} - {}",
|
|
||||||
x,
|
|
||||||
e.to_string()
|
|
||||||
),
|
|
||||||
span: Some(head),
|
span: Some(head),
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ pub fn fail_test(input: &str, expected: &str) -> TestResult {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub fn not_found_msg() -> &'static str {
|
pub fn not_found_msg() -> &'static str {
|
||||||
if cfg!(windows) {
|
if cfg!(windows) {
|
||||||
"cannot find"
|
"not found"
|
||||||
} else {
|
} else {
|
||||||
"No such"
|
"No such"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user