diff --git a/src/commands/save.rs b/src/commands/save.rs index 37882f429..da5c09350 100644 --- a/src/commands/save.rs +++ b/src/commands/save.rs @@ -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)); diff --git a/src/commands/tags.rs b/src/commands/tags.rs index b916c03f8..01c7565d5 100644 --- a/src/commands/tags.rs +++ b/src/commands/tags.rs @@ -38,7 +38,7 @@ fn tags(args: CommandArgs, _registry: &CommandRegistry) -> Result { tags.insert("origin", Value::string(source)); } diff --git a/src/lib.rs b/src/lib.rs index a9ef8740f..cead5e2f8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,7 +3,6 @@ #![feature(generators)] #![feature(try_trait)] #![feature(bind_by_move_pattern_guards)] -#![feature(option_flattening)] #![feature(specialization)] #![feature(proc_macro_hygiene)] diff --git a/src/plugins/binaryview.rs b/src/plugins/binaryview.rs index 5668fa869..58ae9756a 100644 --- a/src/plugins/binaryview.rs +++ b/src/plugins/binaryview.rs @@ -1,4 +1,3 @@ -#![feature(option_flattening)] use crossterm::{cursor, terminal, Attribute, RawScreen}; use indexmap::IndexMap; use nu::{ @@ -32,7 +31,7 @@ impl Plugin for BinaryView { let value_origin = v.origin(); match v.item { Value::Binary(b) => { - let source = value_origin.map(|x| call_info.source_map.get(&x)).flatten(); + let source = value_origin.and_then(|x| call_info.source_map.get(&x)); let _ = view_binary(&b, source, call_info.args.has("lores")); } _ => {} diff --git a/src/plugins/textview.rs b/src/plugins/textview.rs index 92d95c83e..238144cbe 100644 --- a/src/plugins/textview.rs +++ b/src/plugins/textview.rs @@ -1,5 +1,3 @@ -#![feature(option_flattening)] - use crossterm::{cursor, terminal, RawScreen}; use crossterm::{InputEvent, KeyEvent}; use indexmap::IndexMap; @@ -217,7 +215,7 @@ fn view_text_value(value: &Tagged, source_map: &SourceMap) { let value_origin = value.origin(); match value.item { Value::Primitive(Primitive::String(ref s)) => { - let source = value_origin.map(|x| source_map.get(&x)).flatten(); + let source = value_origin.and_then(|x| source_map.get(&x)); if let Some(source) = source { let extension: Option = match source {