mirror of
https://github.com/nushell/nushell.git
synced 2025-08-23 04:31:26 +02:00
Reduce again the number of match calls (#7815)
- Reduce the number of match calls (see commit messages) - A few miscellaneous improvements
This commit is contained in:
@@ -51,9 +51,8 @@ impl Command for ListDF {
|
||||
|
||||
let vals = vals
|
||||
.into_iter()
|
||||
.filter_map(|(name, value)| match NuDataFrame::try_from_value(value) {
|
||||
Ok(df) => Some((name, df)),
|
||||
Err(_) => None,
|
||||
.filter_map(|(name, value)| {
|
||||
NuDataFrame::try_from_value(value).ok().map(|df| (name, df))
|
||||
})
|
||||
.map(|(name, df)| {
|
||||
let name = Value::String {
|
||||
|
@@ -103,14 +103,13 @@ fn command(
|
||||
|
||||
let type_id = match &type_option {
|
||||
Some(ref t) => Some((t.item.to_owned(), "Invalid type", t.span)),
|
||||
None => match file.item.extension() {
|
||||
Some(e) => Some((
|
||||
None => file.item.extension().map(|e| {
|
||||
(
|
||||
e.to_string_lossy().into_owned(),
|
||||
"Invalid extension",
|
||||
file.span,
|
||||
)),
|
||||
None => None,
|
||||
},
|
||||
)
|
||||
}),
|
||||
};
|
||||
|
||||
match type_id {
|
||||
|
Reference in New Issue
Block a user