mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 14:40:06 +02:00
Clippy fixes for new Rust version (#3392)
This commit is contained in:
@ -87,7 +87,7 @@ impl WholeStreamCommand for EachWindow {
|
||||
None
|
||||
}
|
||||
})
|
||||
.filter_map(|x| x)
|
||||
.flatten()
|
||||
.flatten()
|
||||
.to_action_stream())
|
||||
}
|
||||
|
@ -228,8 +228,8 @@ pub fn get_column_from_row_error(
|
||||
} => {
|
||||
let primary_label = format!("There isn't a column named '{}'", &column);
|
||||
|
||||
if let Some(suggestions) = did_you_mean(&obj_source, column_path_tried.as_string()) {
|
||||
Some(ShellError::labeled_error_with_secondary(
|
||||
did_you_mean(&obj_source, column_path_tried.as_string()).map(|suggestions| {
|
||||
ShellError::labeled_error_with_secondary(
|
||||
"Unknown column",
|
||||
primary_label,
|
||||
column_path_tried.span,
|
||||
@ -239,10 +239,8 @@ pub fn get_column_from_row_error(
|
||||
&obj_source.data_descriptors().join(", ")
|
||||
),
|
||||
column_path_tried.span.since(path_members_span),
|
||||
))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
PathMember {
|
||||
unspanned: UnspannedPathMember::Int(idx),
|
||||
|
@ -76,10 +76,10 @@ pub fn histogram(args: CommandArgs) -> Result<ActionStream, ShellError> {
|
||||
};
|
||||
|
||||
let column_grouper = if !columns.is_empty() {
|
||||
match columns.remove(0).split_last() {
|
||||
Some((key, _)) => Some(key.as_string().tagged(&name)),
|
||||
None => None,
|
||||
}
|
||||
columns
|
||||
.remove(0)
|
||||
.split_last()
|
||||
.map(|(key, _)| key.as_string().tagged(&name))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
@ -272,10 +272,7 @@ fn move_after(table: &Value, columns: &[String], from: &ColumnPath) -> Result<Va
|
||||
|
||||
Ok(select_fields(
|
||||
table,
|
||||
&reordered_columns
|
||||
.into_iter()
|
||||
.filter_map(|v| v)
|
||||
.collect::<Vec<_>>(),
|
||||
&reordered_columns.into_iter().flatten().collect::<Vec<_>>(),
|
||||
&table.tag,
|
||||
))
|
||||
}
|
||||
@ -321,10 +318,7 @@ fn move_before(table: &Value, columns: &[String], from: &ColumnPath) -> Result<V
|
||||
|
||||
Ok(select_fields(
|
||||
table,
|
||||
&reordered_columns
|
||||
.into_iter()
|
||||
.filter_map(|v| v)
|
||||
.collect::<Vec<_>>(),
|
||||
&reordered_columns.into_iter().flatten().collect::<Vec<_>>(),
|
||||
&table.tag,
|
||||
))
|
||||
}
|
||||
|
@ -95,10 +95,10 @@ fn where_command(raw_args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
};
|
||||
|
||||
Ok(WhereIterator {
|
||||
block,
|
||||
condition,
|
||||
context,
|
||||
input,
|
||||
block,
|
||||
}
|
||||
.to_output_stream())
|
||||
}
|
||||
|
@ -68,18 +68,16 @@ pub fn chop() {
|
||||
let stdin = io::stdin();
|
||||
let mut stdout = io::stdout();
|
||||
|
||||
for line in stdin.lock().lines() {
|
||||
if let Ok(given) = line {
|
||||
let chopped = if given.is_empty() {
|
||||
&given
|
||||
} else {
|
||||
let to = given.len() - 1;
|
||||
&given[..to]
|
||||
};
|
||||
for given in stdin.lock().lines().flatten() {
|
||||
let chopped = if given.is_empty() {
|
||||
&given
|
||||
} else {
|
||||
let to = given.len() - 1;
|
||||
&given[..to]
|
||||
};
|
||||
|
||||
if let Err(_e) = writeln!(stdout, "{}", chopped) {
|
||||
break;
|
||||
}
|
||||
if let Err(_e) = writeln!(stdout, "{}", chopped) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user