From 95feb1ff16317c53b708ac0b99566f88527f3534 Mon Sep 17 00:00:00 2001
From: Jonathan Turner <jonathan.d.turner@gmail.com>
Date: Tue, 3 Sep 2019 06:06:25 +1200
Subject: [PATCH 1/9] Fix line completion for extended chars

---
 src/shell/completer.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/shell/completer.rs b/src/shell/completer.rs
index 80ed6cfbbf..9e8d4ea827 100644
--- a/src/shell/completer.rs
+++ b/src/shell/completer.rs
@@ -37,8 +37,8 @@ impl NuCompleter {
             }
         }
 
-        let line_chars: Vec<_> = line.chars().collect();
-        let mut replace_pos = pos;
+        let line_chars: Vec<_> = line[..pos].chars().collect();
+        let mut replace_pos = line_chars.len();
         while replace_pos > 0 {
             if line_chars[replace_pos - 1] == ' ' {
                 break;

From d5494e58a4cbbaaebca435a417819ff55e544f21 Mon Sep 17 00:00:00 2001
From: est31 <MTest31@outlook.com>
Date: Mon, 2 Sep 2019 21:12:09 +0200
Subject: [PATCH 2/9] ExtractType doesn't have to be implemented for Option any
 more

---
 src/object/types.rs | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/src/object/types.rs b/src/object/types.rs
index 2f17ed6f03..7965c76023 100644
--- a/src/object/types.rs
+++ b/src/object/types.rs
@@ -15,19 +15,6 @@ impl<T> ExtractType for T {
         )))
     }
 }
-impl<T: ExtractType> ExtractType for Option<T> {
-    fn extract(value: &Tagged<Value>) -> Result<Option<T>, ShellError> {
-        let name = std::any::type_name::<T>();
-        trace!("<Option> Extracting {:?} for Option<{}>", value, name);
-
-        let result = match value.item() {
-            Value::Primitive(Primitive::Nothing) => None,
-            _ => Some(T::extract(value)?),
-        };
-
-        Ok(result)
-    }
-}
 
 impl<T: ExtractType> ExtractType for Tagged<T> {
     fn extract(value: &Tagged<Value>) -> Result<Tagged<T>, ShellError> {

From 9b3a561e830c58a06fd6878cfd19c937b2dbd630 Mon Sep 17 00:00:00 2001
From: est31 <MTest31@outlook.com>
Date: Mon, 2 Sep 2019 22:06:46 +0200
Subject: [PATCH 3/9] Small refactor

---
 src/parser/deserializer.rs | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/parser/deserializer.rs b/src/parser/deserializer.rs
index 33e4b9ead2..a2ec8a96c6 100644
--- a/src/parser/deserializer.rs
+++ b/src/parser/deserializer.rs
@@ -300,15 +300,15 @@ impl<'de, 'a> de::Deserializer<'de> for &'a mut ConfigDeserializer<'de> {
             self.stack
         );
 
-        if self.saw_root {
-            let value = self.pop();
-            let name = std::any::type_name::<V::Value>();
-            trace!("Extracting {:?} for {:?}", value.val, name);
-            V::Value::extract(&value.val)
-        } else {
+        if !self.saw_root {
             self.saw_root = true;
-            visitor.visit_seq(StructDeserializer::new(&mut self, fields))
+            return visitor.visit_seq(StructDeserializer::new(&mut self, fields));
         }
+
+        let value = self.pop();
+        let name = std::any::type_name::<V::Value>();
+        trace!("Extracting {:?} for {:?}", value.val, name);
+        V::Value::extract(&value.val)
     }
     fn deserialize_enum<V>(
         self,

From e8880a1a5727ed1c06bc30704626a6084b5fb2ad Mon Sep 17 00:00:00 2001
From: est31 <MTest31@outlook.com>
Date: Mon, 2 Sep 2019 22:30:51 +0200
Subject: [PATCH 4/9] Deserialize Block using serde

---
 src/object/types.rs        | 13 -------------
 src/parser/deserializer.rs | 16 ++++++++++++++++
 2 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/object/types.rs b/src/object/types.rs
index 7965c76023..ece1ba3bde 100644
--- a/src/object/types.rs
+++ b/src/object/types.rs
@@ -1,4 +1,3 @@
-use crate::object::base as value;
 use crate::prelude::*;
 use log::trace;
 
@@ -106,15 +105,3 @@ impl ExtractType for String {
         }
     }
 }
-
-impl ExtractType for value::Block {
-    fn extract(value: &Tagged<Value>) -> Result<value::Block, ShellError> {
-        match value {
-            Tagged {
-                item: Value::Block(block),
-                ..
-            } => Ok(block.clone()),
-            other => Err(ShellError::type_error("Block", other.tagged_type_name())),
-        }
-    }
-}
diff --git a/src/parser/deserializer.rs b/src/parser/deserializer.rs
index a2ec8a96c6..ea507128ef 100644
--- a/src/parser/deserializer.rs
+++ b/src/parser/deserializer.rs
@@ -306,6 +306,22 @@ impl<'de, 'a> de::Deserializer<'de> for &'a mut ConfigDeserializer<'de> {
         }
 
         let value = self.pop();
+
+        if name == "Block" {
+            let block = match value.val {
+                Tagged {
+                    item: Value::Block(block),
+                    ..
+                } => block,
+                other => return Err(ShellError::type_error("Block", other.tagged_type_name())),
+            };
+            let json = serde_json::to_string(&block)?;
+            let json_cursor = std::io::Cursor::new(json.into_bytes());
+            let mut json_de = serde_json::Deserializer::from_reader(json_cursor);
+            let r = json_de.deserialize_struct(name, fields, visitor)?;
+            return Ok(r);
+        }
+
         let name = std::any::type_name::<V::Value>();
         trace!("Extracting {:?} for {:?}", value.val, name);
         V::Value::extract(&value.val)

From 9ba2e75ac1722d8efd6679b4da0fa9e8691bd50b Mon Sep 17 00:00:00 2001
From: est31 <MTest31@outlook.com>
Date: Mon, 2 Sep 2019 23:21:29 +0200
Subject: [PATCH 5/9] Move code into separate visit function

---
 src/parser/deserializer.rs | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/parser/deserializer.rs b/src/parser/deserializer.rs
index ea507128ef..c3d9370872 100644
--- a/src/parser/deserializer.rs
+++ b/src/parser/deserializer.rs
@@ -293,6 +293,22 @@ impl<'de, 'a> de::Deserializer<'de> for &'a mut ConfigDeserializer<'de> {
     where
         V: Visitor<'de>,
     {
+        fn visit<'de, T, V>(
+            val: T,
+            name: &'static str,
+            fields: &'static [&'static str],
+            visitor: V
+        ) -> Result<V::Value, ShellError>
+        where
+            T: serde::Serialize,
+            V: Visitor<'de>,
+        {
+            let json = serde_json::to_string(&val)?;
+            let json_cursor = std::io::Cursor::new(json.into_bytes());
+            let mut json_de = serde_json::Deserializer::from_reader(json_cursor);
+            let r = json_de.deserialize_struct(name, fields, visitor)?;
+            return Ok(r);
+        }
         trace!(
             "deserializing struct {:?} {:?} (stack={:?})",
             name,
@@ -315,11 +331,7 @@ impl<'de, 'a> de::Deserializer<'de> for &'a mut ConfigDeserializer<'de> {
                 } => block,
                 other => return Err(ShellError::type_error("Block", other.tagged_type_name())),
             };
-            let json = serde_json::to_string(&block)?;
-            let json_cursor = std::io::Cursor::new(json.into_bytes());
-            let mut json_de = serde_json::Deserializer::from_reader(json_cursor);
-            let r = json_de.deserialize_struct(name, fields, visitor)?;
-            return Ok(r);
+            return visit(block, name, fields, visitor);
         }
 
         let name = std::any::type_name::<V::Value>();

From cc8872b4eec3f39896ccb11d9c25a30a79c04dd7 Mon Sep 17 00:00:00 2001
From: est31 <MTest31@outlook.com>
Date: Mon, 2 Sep 2019 23:23:34 +0200
Subject: [PATCH 6/9] Use serde to deserialize Tagged<Value>

---
 src/object/types.rs        |  8 --------
 src/parser/deserializer.rs | 12 +++++++++---
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/src/object/types.rs b/src/object/types.rs
index ece1ba3bde..913c43358a 100644
--- a/src/object/types.rs
+++ b/src/object/types.rs
@@ -24,14 +24,6 @@ impl<T: ExtractType> ExtractType for Tagged<T> {
     }
 }
 
-impl ExtractType for Value {
-    fn extract(value: &Tagged<Value>) -> Result<Value, ShellError> {
-        trace!("<Tagged> Extracting {:?} for Value", value);
-
-        Ok(value.item().clone())
-    }
-}
-
 impl ExtractType for bool {
     fn extract(value: &Tagged<Value>) -> Result<bool, ShellError> {
         trace!("Extracting {:?} for bool", value);
diff --git a/src/parser/deserializer.rs b/src/parser/deserializer.rs
index c3d9370872..1b5f34bfda 100644
--- a/src/parser/deserializer.rs
+++ b/src/parser/deserializer.rs
@@ -323,6 +323,13 @@ impl<'de, 'a> de::Deserializer<'de> for &'a mut ConfigDeserializer<'de> {
 
         let value = self.pop();
 
+        let type_name = std::any::type_name::<V::Value>();
+        let tagged_val_name = std::any::type_name::<Tagged<Value>>();
+
+        if name == tagged_val_name {
+            return visit::<Tagged<Value>, _>(value.val, name, fields, visitor);
+        }
+
         if name == "Block" {
             let block = match value.val {
                 Tagged {
@@ -331,11 +338,10 @@ impl<'de, 'a> de::Deserializer<'de> for &'a mut ConfigDeserializer<'de> {
                 } => block,
                 other => return Err(ShellError::type_error("Block", other.tagged_type_name())),
             };
-            return visit(block, name, fields, visitor);
+            return visit::<value::Block, _>(block, name, fields, visitor);
         }
 
-        let name = std::any::type_name::<V::Value>();
-        trace!("Extracting {:?} for {:?}", value.val, name);
+        trace!("Extracting {:?} for {:?}", value.val, type_name);
         V::Value::extract(&value.val)
     }
     fn deserialize_enum<V>(

From 225ef8e75d9af01b1fc8f372ef9001916a5fcbfb Mon Sep 17 00:00:00 2001
From: est31 <MTest31@outlook.com>
Date: Tue, 3 Sep 2019 02:10:48 +0200
Subject: [PATCH 7/9] Use serde to deserialize the remaining things

---
 src/parser/deserializer.rs | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/src/parser/deserializer.rs b/src/parser/deserializer.rs
index 1b5f34bfda..836b6a02b1 100644
--- a/src/parser/deserializer.rs
+++ b/src/parser/deserializer.rs
@@ -1,6 +1,7 @@
 use crate::prelude::*;
 use log::trace;
 use serde::de;
+use std::path::PathBuf;
 
 #[derive(Debug)]
 pub struct DeserializerItem<'de> {
@@ -342,7 +343,35 @@ impl<'de, 'a> de::Deserializer<'de> for &'a mut ConfigDeserializer<'de> {
         }
 
         trace!("Extracting {:?} for {:?}", value.val, type_name);
-        V::Value::extract(&value.val)
+
+        let tag = value.val.tag();
+        match value.val {
+            Tagged {
+                item: Value::Primitive(Primitive::Boolean(b)),
+                ..
+            } => visit::<Tagged<bool>, _>(b.tagged(tag), name, fields, visitor),
+            Tagged {
+                item: Value::Primitive(Primitive::Nothing),
+                ..
+            } => visit::<Tagged<bool>, _>(false.tagged(tag), name, fields, visitor),
+            Tagged {
+                item: Value::Primitive(Primitive::Path(p)),
+                ..
+            } => visit::<Tagged<PathBuf>, _>(p.clone().tagged(tag), name, fields, visitor),
+            Tagged {
+                item: Value::Primitive(Primitive::Int(int)),
+                ..
+            } => {
+                let i: i64 = int.tagged(value.val.tag).coerce_into("converting to i64")?;
+                visit::<Tagged<i64>, _>(i.tagged(tag), name, fields, visitor)
+            },
+            Tagged {
+                item: Value::Primitive(Primitive::String(string)),
+                ..
+            } => visit::<Tagged<String>, _>(string.tagged(tag), name, fields, visitor),
+
+            other => return Err(ShellError::type_error(name, other.tagged_type_name())),
+        }
     }
     fn deserialize_enum<V>(
         self,

From 35d576f540005167eb84d11bf08c4978484742e1 Mon Sep 17 00:00:00 2001
From: est31 <MTest31@outlook.com>
Date: Tue, 3 Sep 2019 02:13:41 +0200
Subject: [PATCH 8/9] Remove use of specialization

---
 src/lib.rs          |  1 -
 src/object/types.rs | 10 ----------
 2 files changed, 11 deletions(-)

diff --git a/src/lib.rs b/src/lib.rs
index 7a82741199..2e9b8fb061 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,5 +1,4 @@
 #![feature(generators)]
-#![feature(specialization)]
 #![feature(proc_macro_hygiene)]
 
 #[macro_use]
diff --git a/src/object/types.rs b/src/object/types.rs
index 913c43358a..8dca43d878 100644
--- a/src/object/types.rs
+++ b/src/object/types.rs
@@ -5,16 +5,6 @@ pub trait ExtractType: Sized {
     fn extract(value: &Tagged<Value>) -> Result<Self, ShellError>;
 }
 
-impl<T> ExtractType for T {
-    default fn extract(_value: &Tagged<Value>) -> Result<T, ShellError> {
-        let name = std::any::type_name::<T>();
-        Err(ShellError::unimplemented(format!(
-            "<T> ExtractType for {}",
-            name
-        )))
-    }
-}
-
 impl<T: ExtractType> ExtractType for Tagged<T> {
     fn extract(value: &Tagged<Value>) -> Result<Tagged<T>, ShellError> {
         let name = std::any::type_name::<T>();

From cf0efb811e6648d75ac772374637cd39dad34d76 Mon Sep 17 00:00:00 2001
From: est31 <MTest31@outlook.com>
Date: Tue, 3 Sep 2019 02:49:51 +0200
Subject: [PATCH 9/9] Trim trailing whitespace and set it in editorconfig

---
 .editorconfig              |   2 +-
 src/object/dict.rs         |   2 +-
 src/parser/deserializer.rs |   4 +-
 tests/command_cp_tests.rs  |   2 +-
 tests/command_ls_tests.rs  |  42 ++++-----
 tests/command_mv_tests.rs  |   2 +-
 tests/commands_test.rs     |  16 ++--
 tests/filter_str_tests.rs  |  30 +++----
 tests/filters_test.rs      | 174 ++++++++++++++++++-------------------
 tests/tests.rs             |  24 ++---
 10 files changed, 149 insertions(+), 149 deletions(-)

diff --git a/.editorconfig b/.editorconfig
index d280e66381..f6fb9f98d9 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -4,6 +4,6 @@ root = true
 indent_style = space
 indent_size = 4
 charset = utf-8
-trim_trailing_whitespace = false
+trim_trailing_whitespace = true
 insert_final_newline = false
 end_of_line = lf
\ No newline at end of file
diff --git a/src/object/dict.rs b/src/object/dict.rs
index 7fb0b5bcf9..1f53d2ade5 100644
--- a/src/object/dict.rs
+++ b/src/object/dict.rs
@@ -146,7 +146,7 @@ impl TaggedDictBuilder {
             dict: IndexMap::default(),
         }
     }
-    
+
     pub fn with_capacity(tag: impl Into<Tag>, n: usize) -> TaggedDictBuilder {
         TaggedDictBuilder {
             tag: tag.into(),
diff --git a/src/parser/deserializer.rs b/src/parser/deserializer.rs
index 33e4b9ead2..e3741d5f38 100644
--- a/src/parser/deserializer.rs
+++ b/src/parser/deserializer.rs
@@ -58,7 +58,7 @@ impl<'de> ConfigDeserializer<'de> {
 
         Ok(())
     }
-    
+
     pub fn top(&mut self) -> &DeserializerItem {
         let value = self.stack.last();
         trace!("inspecting top value :: {:?}", value);
@@ -191,7 +191,7 @@ impl<'de, 'a> de::Deserializer<'de> for &'a mut ConfigDeserializer<'de> {
     {
         unimplemented!("deserialize_byte_buf")
     }
-    
+
     fn deserialize_option<V>(self, visitor: V) -> Result<V::Value, Self::Error>
     where
         V: Visitor<'de>,
diff --git a/tests/command_cp_tests.rs b/tests/command_cp_tests.rs
index 64e3a8510d..804cfc0166 100644
--- a/tests/command_cp_tests.rs
+++ b/tests/command_cp_tests.rs
@@ -104,7 +104,7 @@ fn deep_copies_with_recursive_flag() {
         let yehudas_expected_copied_dir = expected_dir.join("contributors").join("yehuda");
 
         nu!(
-            cwd: dirs.test(), 
+            cwd: dirs.test(),
             "cp originals expected --recursive"
         );
 
diff --git a/tests/command_ls_tests.rs b/tests/command_ls_tests.rs
index 1e1e33e63e..8ec1d035dc 100644
--- a/tests/command_ls_tests.rs
+++ b/tests/command_ls_tests.rs
@@ -16,13 +16,13 @@ fn ls_lists_regular_files() {
         let actual = nu!(
             cwd: dirs.test(), h::pipeline(
             r#"
-                ls 
-                | get name 
-                | lines 
-                | split-column "." 
-                | get Column2 
-                | str --to-int 
-                | sum 
+                ls
+                | get name
+                | lines
+                | split-column "."
+                | get Column2
+                | str --to-int
+                | sum
                 | echo $it
             "#
         ));
@@ -45,13 +45,13 @@ fn ls_lists_regular_files_using_asterisk_wildcard() {
         let actual = nu!(
             cwd: dirs.test(), h::pipeline(
             r#"
-                ls *.txt 
-                | get name 
-                | lines 
-                | split-column "." 
-                | get Column2 
-                | str --to-int 
-                | sum 
+                ls *.txt
+                | get name
+                | lines
+                | split-column "."
+                | get Column2
+                | str --to-int
+                | sum
                 | echo $it
             "#
         ));
@@ -74,13 +74,13 @@ fn ls_lists_regular_files_using_question_mark_wildcard() {
         let actual = nu!(
             cwd: dirs.test(), h::pipeline(
             r#"
-                ls *.??.txt 
-                | get name 
-                | lines 
-                | split-column "." 
-                | get Column2 
-                | str --to-int 
-                | sum 
+                ls *.??.txt
+                | get name
+                | lines
+                | split-column "."
+                | get Column2
+                | str --to-int
+                | sum
                 | echo $it
             "#
         ));
diff --git a/tests/command_mv_tests.rs b/tests/command_mv_tests.rs
index 4972902a00..61ce842759 100644
--- a/tests/command_mv_tests.rs
+++ b/tests/command_mv_tests.rs
@@ -28,7 +28,7 @@ fn overwrites_if_moving_to_existing_file() {
     Playground::setup("mv_test_2", |dirs, sandbox| {
         sandbox
             .with_files(vec![
-                EmptyFile("andres.txt"), 
+                EmptyFile("andres.txt"),
                 EmptyFile("jonathan.txt")
         ]);
 
diff --git a/tests/commands_test.rs b/tests/commands_test.rs
index 30d283f50b..4d3c9d0086 100644
--- a/tests/commands_test.rs
+++ b/tests/commands_test.rs
@@ -8,14 +8,14 @@ fn lines() {
     let actual = nu!(
         cwd: "tests/fixtures/formats", h::pipeline(
         r#"
-            open cargo_sample.toml --raw 
-            | lines 
-            | skip-while $it != "[dependencies]" 
-            | skip 1 
-            | first 1 
-            | split-column "=" 
-            | get Column1 
-            | trim 
+            open cargo_sample.toml --raw
+            | lines
+            | skip-while $it != "[dependencies]"
+            | skip 1
+            | first 1
+            | split-column "="
+            | get Column1
+            | trim
             | echo $it
         "#
     ));
diff --git a/tests/filter_str_tests.rs b/tests/filter_str_tests.rs
index 44a4b33913..03c9d63532 100644
--- a/tests/filter_str_tests.rs
+++ b/tests/filter_str_tests.rs
@@ -73,7 +73,7 @@ fn upcases() {
             cwd: dirs.test(),
             "open sample.toml | str package.name --upcase | get package.name | echo $it"
         );
-    
+
         assert_eq!(actual, "NUSHELL");
     })
 }
@@ -83,11 +83,11 @@ fn converts_to_int() {
     let actual = nu!(
         cwd: "tests/fixtures/formats", h::pipeline(
         r#"
-            open caco3_plastics.csv 
-            | first 1 
-            | str tariff_item --to-int 
-            | where tariff_item == 2509000000 
-            | get tariff_item 
+            open caco3_plastics.csv
+            | first 1
+            | str tariff_item --to-int
+            | where tariff_item == 2509000000
+            | get tariff_item
             | echo $it
         "#
     ));
@@ -110,9 +110,9 @@ fn replaces() {
         let actual = nu!(
             cwd: dirs.test(), h::pipeline(
             r#"
-                open sample.toml 
-                | str package.name --replace wykittenshell  
-                | get package.name 
+                open sample.toml
+                | str package.name --replace wykittenshell
+                | get package.name
                 | echo $it
             "#
         ));
@@ -136,9 +136,9 @@ fn find_and_replaces() {
         let actual = nu!(
             cwd: dirs.test(), h::pipeline(
             r#"
-                open sample.toml 
-                | str fortune.teller.phone --find-replace KATZ "5289" 
-                | get fortune.teller.phone 
+                open sample.toml
+                | str fortune.teller.phone --find-replace KATZ "5289"
+                | get fortune.teller.phone
                 | echo $it
             "#
         ));
@@ -162,9 +162,9 @@ fn find_and_replaces_without_passing_field() {
         let actual = nu!(
             cwd: dirs.test(), h::pipeline(
             r#"
-                open sample.toml 
-                | get fortune.teller.phone 
-                | str --find-replace KATZ "5289" 
+                open sample.toml
+                | get fortune.teller.phone
+                | str --find-replace KATZ "5289"
                 | echo $it
             "#
         ));
diff --git a/tests/filters_test.rs b/tests/filters_test.rs
index 9e7365ca47..e3ebcd1a6d 100644
--- a/tests/filters_test.rs
+++ b/tests/filters_test.rs
@@ -28,13 +28,13 @@ fn converts_structured_table_to_csv_text() {
         let actual = nu!(
             cwd: dirs.test(), h::pipeline(
             r#"
-                open csv_text_sample.txt 
-                | lines 
-                | split-column "," a b c d origin  
-                | last 1 
-                | to-csv 
-                | lines 
-                | nth 1 
+                open csv_text_sample.txt
+                | lines
+                | split-column "," a b c d origin
+                | last 1
+                | to-csv
+                | lines
+                | nth 1
                 | echo "$it"
             "#
         ));
@@ -58,11 +58,11 @@ fn converts_structured_table_to_csv_text_skipping_headers_after_conversion() {
         let actual = nu!(
             cwd: dirs.test(), h::pipeline(
             r#"
-                open csv_text_sample.txt 
-                | lines 
-                | split-column "," a b c d origin  
-                | last 1 
-                | to-csv --headerless 
+                open csv_text_sample.txt
+                | lines
+                | split-column "," a b c d origin
+                | last 1
+                | to-csv --headerless
                 | echo "$it"
             "#
         ));
@@ -87,11 +87,11 @@ fn converts_from_csv_text_to_structured_table() {
         let actual = nu!(
             cwd: dirs.test(), h::pipeline(
             r#"
-                open los_tres_caballeros.txt 
-                | from-csv 
-                | get rusty_luck 
-                | str --to-int 
-                | sum 
+                open los_tres_caballeros.txt
+                | from-csv
+                | get rusty_luck
+                | str --to-int
+                | sum
                 | echo $it
             "#
         ));
@@ -116,11 +116,11 @@ fn converts_from_csv_text_skipping_headers_to_structured_table() {
         let actual = nu!(
             cwd: dirs.test(), h::pipeline(
             r#"
-                open los_tres_amigos.txt 
-                | from-csv --headerless 
-                | get Column3 
-                | str --to-int 
-                | sum 
+                open los_tres_amigos.txt
+                | from-csv --headerless
+                | get Column3
+                | str --to-int
+                | sum
                 | echo $it
             "#
         ));
@@ -134,10 +134,10 @@ fn can_convert_table_to_json_text_and_from_json_text_back_into_table() {
     let actual = nu!(
         cwd: "tests/fixtures/formats", h::pipeline(
         r#"
-            open sgml_description.json 
-            | to-json 
-            | from-json 
-            | get glossary.GlossDiv.GlossList.GlossEntry.GlossSee 
+            open sgml_description.json
+            | to-json
+            | from-json
+            | get glossary.GlossDiv.GlossList.GlossEntry.GlossSee
             | echo $it
         "#
     ));
@@ -153,8 +153,8 @@ fn converts_from_json_text_to_structured_table() {
             r#"
                 {
                     "katz": [
-                        {"name":   "Yehuda", "rusty_luck": 1}, 
-                        {"name": "Jonathan", "rusty_luck": 1}, 
+                        {"name":   "Yehuda", "rusty_luck": 1},
+                        {"name": "Jonathan", "rusty_luck": 1},
                         {"name":   "Andres", "rusty_luck": 1},
                         {"name":"GorbyPuff", "rusty_luck": 1}
                     ]
@@ -177,8 +177,8 @@ fn converts_from_json_text_recognizing_objects_independendtly_to_structured_tabl
         sandbox.with_files(vec![FileWithContentToBeTrimmed(
             "katz.txt",
             r#"
-                {"name":   "Yehuda", "rusty_luck": 1} 
-                {"name": "Jonathan", "rusty_luck": 1} 
+                {"name":   "Yehuda", "rusty_luck": 1}
+                {"name": "Jonathan", "rusty_luck": 1}
                 {"name":   "Andres", "rusty_luck": 1}
                 {"name":"GorbyPuff", "rusty_luck": 3}
             "#,
@@ -187,10 +187,10 @@ fn converts_from_json_text_recognizing_objects_independendtly_to_structured_tabl
         let actual = nu!(
             cwd: dirs.test(), h::pipeline(
             r#"
-                open katz.txt 
-                | from-json --objects 
-                | where name == "GorbyPuff" 
-                | get rusty_luck 
+                open katz.txt
+                | from-json --objects
+                | where name == "GorbyPuff"
+                | get rusty_luck
                 | echo $it
             "#
         ));
@@ -213,14 +213,14 @@ fn converts_structured_table_to_json_text() {
         let actual = nu!(
             cwd: dirs.test(), h::pipeline(
             r#"
-                open sample.txt 
-                | lines 
-                | split-column "," name luck 
-                | pick name 
-                | to-json 
-                | nth 0 
-                | from-json 
-                | get name 
+                open sample.txt
+                | lines
+                | split-column "," name luck
+                | pick name
+                | to-json
+                | nth 0
+                | from-json
+                | get name
                 | echo $it
             "#
         ));
@@ -254,13 +254,13 @@ fn converts_structured_table_to_tsv_text() {
         let actual = nu!(
             cwd: dirs.test(), h::pipeline(
             r#"
-                open tsv_text_sample.txt 
-                | lines 
-                | split-column "\t" a b c d origin  
-                | last 1 
+                open tsv_text_sample.txt
+                | lines
+                | split-column "\t" a b c d origin
+                | last 1
                 | to-tsv
-                | lines 
-                | nth 1 
+                | lines
+                | nth 1
                 | echo "$it"
             "#
         ));
@@ -284,11 +284,11 @@ fn converts_structured_table_to_tsv_text_skipping_headers_after_conversion() {
         let actual = nu!(
             cwd: dirs.test(), h::pipeline(
             r#"
-                open tsv_text_sample.txt 
-                | lines 
-                | split-column "\t" a b c d origin  
-                | last 1 
-                | to-tsv --headerless 
+                open tsv_text_sample.txt
+                | lines
+                | split-column "\t" a b c d origin
+                | last 1
+                | to-tsv --headerless
                 | echo "$it"
             "#
         ));
@@ -313,11 +313,11 @@ fn converts_from_tsv_text_to_structured_table() {
         let actual = nu!(
             cwd: dirs.test(), h::pipeline(
             r#"
-                open los_tres_amigos.txt 
-                | from-tsv 
-                | get rusty_luck 
-                | str --to-int 
-                | sum 
+                open los_tres_amigos.txt
+                | from-tsv
+                | get rusty_luck
+                | str --to-int
+                | sum
                 | echo $it
             "#
         ));
@@ -412,10 +412,10 @@ fn can_convert_table_to_yaml_text_and_from_yaml_text_back_into_table() {
     let actual = nu!(
         cwd: "tests/fixtures/formats", h::pipeline(
         r#"
-            open appveyor.yml 
-            | to-yaml 
-            | from-yaml 
-            | get environment.global.PROJECT_NAME 
+            open appveyor.yml
+            | to-yaml
+            | from-yaml
+            | get environment.global.PROJECT_NAME
             | echo $it
         "#
     ));
@@ -428,16 +428,16 @@ fn can_sort_by_column() {
     let actual = nu!(
         cwd: "tests/fixtures/formats", h::pipeline(
         r#"
-            open cargo_sample.toml --raw 
-            | lines 
-            | skip 1 
-            | first 4 
-            | split-column "=" 
-            | sort-by Column1 
-            | skip 1 
-            | first 1 
-            | get Column1 
-            | trim 
+            open cargo_sample.toml --raw
+            | lines
+            | skip 1
+            | first 4
+            | split-column "="
+            | sort-by Column1
+            | skip 1
+            | first 1
+            | get Column1
+            | trim
             | echo $it
         "#
     ));
@@ -450,13 +450,13 @@ fn can_split_by_column() {
     let actual = nu!(
         cwd: "tests/fixtures/formats", h::pipeline(
         r#"
-            open cargo_sample.toml --raw 
-            | lines 
-            | skip 1 
-            | first 1 
-            | split-column "=" 
-            | get Column1 
-            | trim 
+            open cargo_sample.toml --raw
+            | lines
+            | skip 1
+            | first 1
+            | split-column "="
+            | get Column1
+            | trim
             | echo $it
         "#
     ));
@@ -469,9 +469,9 @@ fn can_sum() {
     let actual = nu!(
         cwd: "tests/fixtures/formats", h::pipeline(
         r#"
-            open sgml_description.json 
-            | get glossary.GlossDiv.GlossList.GlossEntry.Sections 
-            | sum 
+            open sgml_description.json
+            | get glossary.GlossDiv.GlossList.GlossEntry.Sections
+            | sum
             | echo $it
         "#
     ));
@@ -525,10 +525,10 @@ fn embed() {
         let actual = nu!(
             cwd: dirs.test(), h::pipeline(
             r#"
-                open los_tres_caballeros.txt 
+                open los_tres_caballeros.txt
                 | from-csv
-                | embed caballeros 
-                | get caballeros 
+                | embed caballeros
+                | get caballeros
                 | nth 0
                 | get last_name
                 | echo $it
@@ -555,8 +555,8 @@ fn get() {
         let actual = nu!(
             cwd: dirs.test(), h::pipeline(
             r#"
-                open los_tres_caballeros.txt 
-                | from-csv 
+                open los_tres_caballeros.txt
+                | from-csv
                 | nth 1
                 | get last_name
                 | echo $it
diff --git a/tests/tests.rs b/tests/tests.rs
index e74db098d5..4affb44223 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -6,11 +6,11 @@ use helpers as h;
 fn pipeline_helper() {
     let actual = h::pipeline(
         r#"
-            open los_tres_amigos.txt 
-            | from-csv 
-            | get rusty_luck 
-            | str --to-int 
-            | sum 
+            open los_tres_amigos.txt
+            | from-csv
+            | get rusty_luck
+            | str --to-int
+            | sum
             | echo "$it"
         "#);
 
@@ -30,7 +30,7 @@ fn external_num() {
 #[test]
 fn external_has_correct_quotes() {
     let actual = nu!(
-        cwd: ".", 
+        cwd: ".",
         r#"echo "hello world""#
     );
 
@@ -44,9 +44,9 @@ fn add_plugin() {
     let actual = nu!(
         cwd: "tests/fixtures/formats", h::pipeline(
         r#"
-            open cargo_sample.toml 
-            | add dev-dependencies.newdep "1" 
-            | get dev-dependencies.newdep 
+            open cargo_sample.toml
+            | add dev-dependencies.newdep "1"
+            | get dev-dependencies.newdep
             | echo $it
         "#
     ));
@@ -59,9 +59,9 @@ fn edit_plugin() {
     let actual = nu!(
         cwd: "tests/fixtures/formats", h::pipeline(
         r#"
-            open cargo_sample.toml 
-            | edit dev-dependencies.pretty_assertions "7" 
-            | get dev-dependencies.pretty_assertions 
+            open cargo_sample.toml
+            | edit dev-dependencies.pretty_assertions "7"
+            | get dev-dependencies.pretty_assertions
             | echo $it
         "#
     ));