mirror of
https://github.com/nushell/nushell.git
synced 2025-08-19 12:56:46 +02:00
Replace use of unstable Option::flatten() with and_then()
This commit is contained in:
@@ -59,7 +59,7 @@ fn save(
|
||||
// If there is no filename, check the metadata for the origin filename
|
||||
if input.len() > 0 {
|
||||
let origin = input[0].origin();
|
||||
match origin.map(|x| source_map.get(&x)).flatten() {
|
||||
match origin.and_then(|x| source_map.get(&x)) {
|
||||
Some(path) => match path {
|
||||
SpanSource::File(file) => {
|
||||
full_path.push(Path::new(file));
|
||||
|
@@ -38,7 +38,7 @@ fn tags(args: CommandArgs, _registry: &CommandRegistry) -> Result<OutputStream,
|
||||
dict.insert("end", Value::int(span.end as i64));
|
||||
tags.insert_tagged("span", dict.into_tagged_value());
|
||||
|
||||
match origin.map(|x| source_map.get(&x)).flatten() {
|
||||
match origin.and_then(|x| source_map.get(&x)) {
|
||||
Some(SpanSource::File(source)) => {
|
||||
tags.insert("origin", Value::string(source));
|
||||
}
|
||||
|
Reference in New Issue
Block a user