diff --git a/build.rs b/build.rs
index bca47492676f4dbe459962ad82173e762b12096b..9a32b7a2f15a66509c2a211f60ab425068d225c6 100644
--- a/build.rs
+++ b/build.rs
@@ -38,12 +38,17 @@ fn get_git_rev() -> io::Result<String> {
     if version_file.exists() {
         fs::read_to_string(&version_file)
     } else {
-        Command::new("git").arg("rev-parse").arg("master").output()
+        Command::new("git")
+            .arg("rev-parse")
+            .arg("master")
+            .output()
             .and_then(|out| {
-                String::from_utf8(out.stdout).map_err(|_| io::Error::new(
-                    io::ErrorKind::InvalidData,
-                    format!("git rev-parse master output was not UTF-8")
-                ))
+                String::from_utf8(out.stdout).map_err(|_| {
+                    io::Error::new(
+                        io::ErrorKind::InvalidData,
+                        "git rev-parse master output was not UTF-8",
+                    )
+                })
             })
             .or_else(|_| git_rev_from_file())
     }
diff --git a/members/braces/src/lib.rs b/members/braces/src/lib.rs
index 0b304f3b2538a63bb9de1dc9c9d144ba47711ec6..8b4b9a0979bf4cf7c379b8fd025e9a619912b054 100644
--- a/members/braces/src/lib.rs
+++ b/members/braces/src/lib.rs
@@ -76,19 +76,17 @@ impl<'a> Iterator for MultipleBraceExpand<'a> {
     fn next(&mut self) -> Option<Self::Item> {
         if self.permutator.next_with_buffer(&mut self.buffer) {
             let mut strings = self.buffer.iter();
-            let small_vec: SmallVec<[u8; 64]> = self.tokens.iter().fold(
-                SmallVec::with_capacity(64),
-                |mut small_vec, token| match *token {
-                    BraceToken::Normal(ref text) => {
-                        escape_string(&mut small_vec, text);
-                        small_vec
-                    }
-                    BraceToken::Expander => {
-                        escape_string(&mut small_vec, strings.next().unwrap());
-                        small_vec
-                    }
-                },
-            );
+            let small_vec =
+                self.tokens.iter().fold(SmallVec::with_capacity(64), |mut small_vec, token| {
+                    escape_string(
+                        &mut small_vec,
+                        match *token {
+                            BraceToken::Normal(ref text) => text,
+                            BraceToken::Expander => strings.next().unwrap(),
+                        },
+                    );
+                    small_vec
+                });
             Some(unsafe { small::String::from_utf8_unchecked(small_vec.to_vec()) })
         } else {
             None
@@ -114,42 +112,34 @@ where
     fn next(&mut self) -> Option<Self::Item> {
         match self.loop_count {
             0 => {
-                let small_vec: SmallVec<[u8; 64]> = self.tokens.iter().fold(
-                    SmallVec::with_capacity(64),
-                    |mut small_vec, token| match *token {
-                        BraceToken::Normal(ref text) => {
-                            escape_string(&mut small_vec, text);
-                            small_vec
-                        }
-                        BraceToken::Expander => {
-                            escape_string(&mut small_vec, self.elements.next().unwrap());
-                            small_vec
-                        }
-                    },
-                );
+                let small_vec =
+                    self.tokens.iter().fold(SmallVec::with_capacity(64), |mut small_vec, token| {
+                        escape_string(
+                            &mut small_vec,
+                            match *token {
+                                BraceToken::Normal(ref text) => text,
+                                BraceToken::Expander => self.elements.next().unwrap(),
+                            },
+                        );
+                        small_vec
+                    });
                 self.loop_count = 1;
                 Some(unsafe { small::String::from_utf8_unchecked(small_vec.to_vec()) })
             }
-            _ => {
-                if let Some(element) = self.elements.next() {
-                    let small_vec: SmallVec<[u8; 64]> = self.tokens.iter().fold(
-                        SmallVec::with_capacity(64),
-                        |mut small_vec, token| match *token {
-                            BraceToken::Normal(ref text) => {
-                                escape_string(&mut small_vec, text);
-                                small_vec
-                            }
-                            BraceToken::Expander => {
-                                escape_string(&mut small_vec, element);
-                                small_vec
-                            }
-                        },
-                    );
-                    Some(unsafe { small::String::from_utf8_unchecked(small_vec.to_vec()) })
-                } else {
-                    None
-                }
-            }
+            _ => self.elements.next().and_then(|element| {
+                let small_vec =
+                    self.tokens.iter().fold(SmallVec::with_capacity(64), |mut small_vec, token| {
+                        escape_string(
+                            &mut small_vec,
+                            match *token {
+                                BraceToken::Normal(ref text) => text,
+                                BraceToken::Expander => element,
+                            },
+                        );
+                        small_vec
+                    });
+                Some(unsafe { small::String::from_utf8_unchecked(small_vec.to_vec()) })
+            }),
         }
     }
 }
@@ -193,8 +183,9 @@ mod tests {
             SingleBraceExpand {
                 elements: elements.iter().map(|element| *element),
                 tokens,
-                loop_count: 0,
-            }.collect::<Vec<small::String>>(),
+                loop_count: 0
+            }
+            .collect::<Vec<small::String>>(),
             vec![
                 small::String::from("A=one"),
                 small::String::from("A=two"),
diff --git a/members/builtins/src/conditionals.rs b/members/builtins/src/conditionals.rs
index 0dc83bad26938a492e9275848f060e9e744fb232..e17ffaa35df7e3a25ccbd441650c6485808adfa2 100644
--- a/members/builtins/src/conditionals.rs
+++ b/members/builtins/src/conditionals.rs
@@ -8,16 +8,8 @@ macro_rules! string_function {
                     eprintln!("ion: {}: two arguments must be supplied", args[0]);
                     return 2;
                 }
-                3 => if args[1].$method(args[2].as_str()) {
-                    0
-                } else {
-                    1
-                },
-                _ => if args[2..].iter().any(|arg| args[1].$method(arg.as_str())) {
-                    0
-                } else {
-                    1
-                },
+                3 => !args[1].$method(args[2].as_str()) as i32,
+                _ => !args[2..].iter().any(|arg| args[1].$method(arg.as_str())) as i32,
             }
         }
     };
diff --git a/members/builtins/src/echo.rs b/members/builtins/src/echo.rs
index 0911a3e98e186f2ec5c1f3daa457e1d6fcf065cf..176407084cca53f6d107eba8babe20dac3a652ed 100644
--- a/members/builtins/src/echo.rs
+++ b/members/builtins/src/echo.rs
@@ -19,7 +19,7 @@ pub fn echo(args: &[small::String]) -> Result<(), io::Error> {
             "--escape" => flags |= Flags::ESCAPE,
             "--no-newline" => flags |= Flags::NO_NEWLINE,
             "--no-spaces" => flags |= Flags::NO_SPACES,
-            _ => if arg.starts_with('-') {
+            _ if arg.starts_with('-') => {
                 let mut is_opts = true;
                 let opts = &arg[1..];
                 let mut short_flags = Flags::empty();
@@ -39,9 +39,10 @@ pub fn echo(args: &[small::String]) -> Result<(), io::Error> {
                 } else {
                     data.push(arg);
                 }
-            } else {
+            }
+            _ => {
                 data.push(arg);
-            },
+            }
         }
     }
 
diff --git a/members/builtins/src/random.rs b/members/builtins/src/random.rs
index 8dc6b0bf2e9eb38b466b0908fa9247ed13511caf..925fc02cea8026f07071b7fcfc61fd038633d4d1 100644
--- a/members/builtins/src/random.rs
+++ b/members/builtins/src/random.rs
@@ -33,10 +33,7 @@ pub fn random(args: &[small::String]) -> Result<(), small::String> {
             writeln!(stdout, "{}", rand_num);
         }
         1 => {
-            writeln!(
-                stdout,
-                "Ion Shell does not currently support changing the seed"
-            );
+            writeln!(stdout, "Ion Shell does not currently support changing the seed");
         }
         2 => {
             let arg1 = match args[0].parse::<u64>() {
diff --git a/members/builtins/src/test.rs b/members/builtins/src/test.rs
index e4cf98a46bdd7c408b19bb3ea324c8c205f992c2..949c8efddc19c22ed8c37ad40f085a2e68d51455 100644
--- a/members/builtins/src/test.rs
+++ b/members/builtins/src/test.rs
@@ -144,15 +144,13 @@ fn evaluate_arguments(arguments: &[small::String]) -> Result<bool, small::String
         }
         Some(arg) => {
             // If there is no operator, check if the first argument is non-zero
-            arguments
-                .get(1)
-                .map_or(Ok(string_is_nonzero(arg)), |operator| {
-                    // If there is no right hand argument, a condition was expected
-                    let right_arg = arguments
-                        .get(2)
-                        .ok_or_else(|| small::String::from("parse error: condition expected"))?;
-                    evaluate_expression(arg, operator, right_arg)
-                })
+            arguments.get(1).map_or(Ok(string_is_nonzero(arg)), |operator| {
+                // If there is no right hand argument, a condition was expected
+                let right_arg = arguments
+                    .get(2)
+                    .ok_or_else(|| small::String::from("parse error: condition expected"))?;
+                evaluate_expression(arg, operator, right_arg)
+            })
         }
         None => {
             println!("{}", QUICK_GUIDE);
@@ -189,7 +187,8 @@ fn files_have_same_device_and_inode_numbers(first: &str, second: &str) -> bool {
     get_dev_and_inode(first).map_or(false, |left| {
         // Obtain the device and inode of the second file or return FAILED
         get_dev_and_inode(second).map_or(false, |right| {
-            // Compare the device and inodes of the first and second files
+            // Compare the device and inodes of the
+            // first and second files
             left == right
         })
     })
@@ -197,18 +196,19 @@ fn files_have_same_device_and_inode_numbers(first: &str, second: &str) -> bool {
 
 /// Obtains the device and inode numbers of the file specified
 fn get_dev_and_inode(filename: &str) -> Option<(u64, u64)> {
-    fs::metadata(filename)
-        .map(|file| (file.dev(), file.ino()))
-        .ok()
+    fs::metadata(filename).map(|file| (file.dev(), file.ino())).ok()
 }
 
 /// Exits SUCCESS if the first file is newer than the second file.
 fn file_is_newer_than(first: &str, second: &str) -> bool {
     // Obtain the modified file time of the first file or return FAILED
     get_modified_file_time(first).map_or(false, |left| {
-        // Obtain the modified file time of the second file or return FAILED
+        // Obtain the modified file time of the second file or return
+        // FAILED
         get_modified_file_time(second).map_or(false, |right| {
-            // If the first file is newer than the right file, return SUCCESS
+            // If the first file is newer
+            // than the right file,
+            // return SUCCESS
             left > right
         })
     })
@@ -216,9 +216,7 @@ fn file_is_newer_than(first: &str, second: &str) -> bool {
 
 /// Obtain the time the file was last modified as a `SystemTime` type.
 fn get_modified_file_time(filename: &str) -> Option<SystemTime> {
-    fs::metadata(filename)
-        .ok()
-        .and_then(|file| file.modified().ok())
+    fs::metadata(filename).ok().and_then(|file| file.modified().ok())
 }
 
 /// Attempt to parse a &str as a usize.
@@ -272,9 +270,7 @@ fn match_flag_argument(flag: char, argument: &str) -> bool {
 
 /// Exits SUCCESS if the file size is greather than zero.
 fn file_size_is_greater_than_zero(filepath: &str) -> bool {
-    fs::metadata(filepath)
-        .ok()
-        .map_or(false, |metadata| metadata.len() > 0)
+    fs::metadata(filepath).ok().map_or(false, |metadata| metadata.len() > 0)
 }
 
 /// Exits SUCCESS if the file has read permissions. This function is rather low level because
@@ -287,7 +283,9 @@ fn file_has_read_permission(filepath: &str) -> bool {
     const GUEST: u32 = 0b100;
 
     // Collect the mode of permissions for the file
-    fs::metadata(filepath).map(|metadata| metadata.permissions().mode()).ok()
+    fs::metadata(filepath)
+        .map(|metadata| metadata.permissions().mode())
+        .ok()
         // If the mode is equal to any of the above, return `SUCCESS`
         .map_or(false, |mode| mode & (USER + GROUP + GUEST) != 0)
 }
@@ -302,7 +300,9 @@ fn file_has_write_permission(filepath: &str) -> bool {
     const GUEST: u32 = 0b10;
 
     // Collect the mode of permissions for the file
-    fs::metadata(filepath).map(|metadata| metadata.permissions().mode()).ok()
+    fs::metadata(filepath)
+        .map(|metadata| metadata.permissions().mode())
+        .ok()
         // If the mode is equal to any of the above, return `SUCCESS`
         .map_or(false, |mode| mode & (USER + GROUP + GUEST) != 0)
 }
@@ -319,30 +319,26 @@ fn file_has_execute_permission(filepath: &str) -> bool {
     const GUEST: u32 = 0b1;
 
     // Collect the mode of permissions for the file
-    fs::metadata(filepath).map(|metadata| metadata.permissions().mode()).ok()
+    fs::metadata(filepath)
+        .map(|metadata| metadata.permissions().mode())
+        .ok()
         // If the mode is equal to any of the above, return `SUCCESS`
         .map_or(false, |mode| mode & (USER + GROUP + GUEST) != 0)
 }
 
 /// Exits SUCCESS if the file argument is a socket
 fn file_is_socket(filepath: &str) -> bool {
-    fs::metadata(filepath)
-        .ok()
-        .map_or(false, |metadata| metadata.file_type().is_socket())
+    fs::metadata(filepath).ok().map_or(false, |metadata| metadata.file_type().is_socket())
 }
 
 /// Exits SUCCESS if the file argument is a block device
 fn file_is_block_device(filepath: &str) -> bool {
-    fs::metadata(filepath)
-        .ok()
-        .map_or(false, |metadata| metadata.file_type().is_block_device())
+    fs::metadata(filepath).ok().map_or(false, |metadata| metadata.file_type().is_block_device())
 }
 
 /// Exits SUCCESS if the file argument is a character device
 fn file_is_character_device(filepath: &str) -> bool {
-    fs::metadata(filepath)
-        .ok()
-        .map_or(false, |metadata| metadata.file_type().is_char_device())
+    fs::metadata(filepath).ok().map_or(false, |metadata| metadata.file_type().is_char_device())
 }
 
 /// Exits SUCCESS if the file exists
@@ -350,23 +346,17 @@ fn file_exists(filepath: &str) -> bool { Path::new(filepath).exists() }
 
 /// Exits SUCCESS if the file is a regular file
 fn file_is_regular(filepath: &str) -> bool {
-    fs::metadata(filepath)
-        .ok()
-        .map_or(false, |metadata| metadata.file_type().is_file())
+    fs::metadata(filepath).ok().map_or(false, |metadata| metadata.file_type().is_file())
 }
 
 /// Exits SUCCESS if the file is a directory
 fn file_is_directory(filepath: &str) -> bool {
-    fs::metadata(filepath)
-        .ok()
-        .map_or(false, |metadata| metadata.file_type().is_dir())
+    fs::metadata(filepath).ok().map_or(false, |metadata| metadata.file_type().is_dir())
 }
 
 /// Exits SUCCESS if the file is a symbolic link
 fn file_is_symlink(filepath: &str) -> bool {
-    fs::symlink_metadata(filepath)
-        .ok()
-        .map_or(false, |metadata| metadata.file_type().is_symlink())
+    fs::symlink_metadata(filepath).ok().map_or(false, |metadata| metadata.file_type().is_symlink())
 }
 
 /// Exits SUCCESS if the string is not empty
@@ -396,128 +386,44 @@ fn test_integers_arguments() {
         args.iter().map(|s| (*s).into()).collect()
     }
     // Equal To
-    assert_eq!(
-        evaluate_arguments(&vec_string(&["10", "-eq", "10"])),
-        Ok(true)
-    );
-    assert_eq!(
-        evaluate_arguments(&vec_string(&["10", "-eq", "5"])),
-        Ok(false)
-    );
-    assert_eq!(
-        evaluate_arguments(&vec_string(&["-10", "-eq", "-10"])),
-        Ok(true)
-    );
-    assert_eq!(
-        evaluate_arguments(&vec_string(&["-10", "-eq", "10"])),
-        Ok(false)
-    );
+    assert_eq!(evaluate_arguments(&vec_string(&["10", "-eq", "10"])), Ok(true));
+    assert_eq!(evaluate_arguments(&vec_string(&["10", "-eq", "5"])), Ok(false));
+    assert_eq!(evaluate_arguments(&vec_string(&["-10", "-eq", "-10"])), Ok(true));
+    assert_eq!(evaluate_arguments(&vec_string(&["-10", "-eq", "10"])), Ok(false));
 
     // Greater Than or Equal To
-    assert_eq!(
-        evaluate_arguments(&vec_string(&["10", "-ge", "10"])),
-        Ok(true)
-    );
-    assert_eq!(
-        evaluate_arguments(&vec_string(&["10", "-ge", "5"])),
-        Ok(true)
-    );
-    assert_eq!(
-        evaluate_arguments(&vec_string(&["5", "-ge", "10"])),
-        Ok(false)
-    );
-    assert_eq!(
-        evaluate_arguments(&vec_string(&["-9", "-ge", "-10"])),
-        Ok(true)
-    );
-    assert_eq!(
-        evaluate_arguments(&vec_string(&["-10", "-ge", "-10"])),
-        Ok(true)
-    );
-    assert_eq!(
-        evaluate_arguments(&vec_string(&["-10", "-ge", "10"])),
-        Ok(false)
-    );
+    assert_eq!(evaluate_arguments(&vec_string(&["10", "-ge", "10"])), Ok(true));
+    assert_eq!(evaluate_arguments(&vec_string(&["10", "-ge", "5"])), Ok(true));
+    assert_eq!(evaluate_arguments(&vec_string(&["5", "-ge", "10"])), Ok(false));
+    assert_eq!(evaluate_arguments(&vec_string(&["-9", "-ge", "-10"])), Ok(true));
+    assert_eq!(evaluate_arguments(&vec_string(&["-10", "-ge", "-10"])), Ok(true));
+    assert_eq!(evaluate_arguments(&vec_string(&["-10", "-ge", "10"])), Ok(false));
 
     // Less Than or Equal To
-    assert_eq!(
-        evaluate_arguments(&vec_string(&["5", "-le", "5"])),
-        Ok(true)
-    );
-    assert_eq!(
-        evaluate_arguments(&vec_string(&["5", "-le", "10"])),
-        Ok(true)
-    );
-    assert_eq!(
-        evaluate_arguments(&vec_string(&["10", "-le", "5"])),
-        Ok(false)
-    );
-    assert_eq!(
-        evaluate_arguments(&vec_string(&["-11", "-le", "-10"])),
-        Ok(true)
-    );
-    assert_eq!(
-        evaluate_arguments(&vec_string(&["-10", "-le", "-10"])),
-        Ok(true)
-    );
-    assert_eq!(
-        evaluate_arguments(&vec_string(&["10", "-le", "-10"])),
-        Ok(false)
-    );
+    assert_eq!(evaluate_arguments(&vec_string(&["5", "-le", "5"])), Ok(true));
+    assert_eq!(evaluate_arguments(&vec_string(&["5", "-le", "10"])), Ok(true));
+    assert_eq!(evaluate_arguments(&vec_string(&["10", "-le", "5"])), Ok(false));
+    assert_eq!(evaluate_arguments(&vec_string(&["-11", "-le", "-10"])), Ok(true));
+    assert_eq!(evaluate_arguments(&vec_string(&["-10", "-le", "-10"])), Ok(true));
+    assert_eq!(evaluate_arguments(&vec_string(&["10", "-le", "-10"])), Ok(false));
 
     // Less Than
-    assert_eq!(
-        evaluate_arguments(&vec_string(&["5", "-lt", "10"])),
-        Ok(true)
-    );
-    assert_eq!(
-        evaluate_arguments(&vec_string(&["10", "-lt", "5"])),
-        Ok(false)
-    );
-    assert_eq!(
-        evaluate_arguments(&vec_string(&["-11", "-lt", "-10"])),
-        Ok(true)
-    );
-    assert_eq!(
-        evaluate_arguments(&vec_string(&["10", "-lt", "-10"])),
-        Ok(false)
-    );
+    assert_eq!(evaluate_arguments(&vec_string(&["5", "-lt", "10"])), Ok(true));
+    assert_eq!(evaluate_arguments(&vec_string(&["10", "-lt", "5"])), Ok(false));
+    assert_eq!(evaluate_arguments(&vec_string(&["-11", "-lt", "-10"])), Ok(true));
+    assert_eq!(evaluate_arguments(&vec_string(&["10", "-lt", "-10"])), Ok(false));
 
     // Greater Than
-    assert_eq!(
-        evaluate_arguments(&vec_string(&["10", "-gt", "5"])),
-        Ok(true)
-    );
-    assert_eq!(
-        evaluate_arguments(&vec_string(&["5", "-gt", "10"])),
-        Ok(false)
-    );
-    assert_eq!(
-        evaluate_arguments(&vec_string(&["-9", "-gt", "-10"])),
-        Ok(true)
-    );
-    assert_eq!(
-        evaluate_arguments(&vec_string(&["-10", "-gt", "10"])),
-        Ok(false)
-    );
+    assert_eq!(evaluate_arguments(&vec_string(&["10", "-gt", "5"])), Ok(true));
+    assert_eq!(evaluate_arguments(&vec_string(&["5", "-gt", "10"])), Ok(false));
+    assert_eq!(evaluate_arguments(&vec_string(&["-9", "-gt", "-10"])), Ok(true));
+    assert_eq!(evaluate_arguments(&vec_string(&["-10", "-gt", "10"])), Ok(false));
 
     // Not Equal To
-    assert_eq!(
-        evaluate_arguments(&vec_string(&["10", "-ne", "5"])),
-        Ok(true)
-    );
-    assert_eq!(
-        evaluate_arguments(&vec_string(&["5", "-ne", "5"])),
-        Ok(false)
-    );
-    assert_eq!(
-        evaluate_arguments(&vec_string(&["-10", "-ne", "-10"])),
-        Ok(false)
-    );
-    assert_eq!(
-        evaluate_arguments(&vec_string(&["-10", "-ne", "10"])),
-        Ok(true)
-    );
+    assert_eq!(evaluate_arguments(&vec_string(&["10", "-ne", "5"])), Ok(true));
+    assert_eq!(evaluate_arguments(&vec_string(&["5", "-ne", "5"])), Ok(false));
+    assert_eq!(evaluate_arguments(&vec_string(&["-10", "-ne", "-10"])), Ok(false));
+    assert_eq!(evaluate_arguments(&vec_string(&["-10", "-ne", "10"])), Ok(true));
 }
 
 #[test]
@@ -546,24 +452,12 @@ fn test_file_is_symlink() {
 
 #[test]
 fn test_file_has_execute_permission() {
-    assert_eq!(
-        file_has_execute_permission("../../testing/executable_file"),
-        true
-    );
-    assert_eq!(
-        file_has_execute_permission("../../testing/empty_file"),
-        false
-    );
+    assert_eq!(file_has_execute_permission("../../testing/executable_file"), true);
+    assert_eq!(file_has_execute_permission("../../testing/empty_file"), false);
 }
 
 #[test]
 fn test_file_size_is_greater_than_zero() {
-    assert_eq!(
-        file_size_is_greater_than_zero("../../testing/file_with_text"),
-        true
-    );
-    assert_eq!(
-        file_size_is_greater_than_zero("../../testing/empty_file"),
-        false
-    );
+    assert_eq!(file_size_is_greater_than_zero("../../testing/file_with_text"), true);
+    assert_eq!(file_size_is_greater_than_zero("../../testing/empty_file"), false);
 }
diff --git a/members/lexers/src/arguments.rs b/members/lexers/src/arguments.rs
index 02a13adc09e78db426373a98c63efb594cc88e7c..a07b12a241d7641b1e0c6105efc874c0da2ebfc9 100644
--- a/members/lexers/src/arguments.rs
+++ b/members/lexers/src/arguments.rs
@@ -24,11 +24,7 @@ pub struct ArgumentSplitter<'a> {
 
 impl<'a> ArgumentSplitter<'a> {
     pub fn new(data: &'a str) -> ArgumentSplitter<'a> {
-        ArgumentSplitter {
-            data,
-            read: 0,
-            bitflags: ArgumentFlags::empty(),
-        }
+        ArgumentSplitter { data, read: 0, bitflags: ArgumentFlags::empty() }
     }
 }
 
@@ -72,16 +68,14 @@ impl<'a> Iterator for ArgumentSplitter<'a> {
                 // Disable COMM_1 and enable COMM_2 + ARRAY.
                 b'@' => {
                     self.bitflags.remove(ArgumentFlags::COMM_1);
-                    self.bitflags
-                        .insert(ArgumentFlags::COMM_2 | ArgumentFlags::ARRAY);
+                    self.bitflags.insert(ArgumentFlags::COMM_2 | ArgumentFlags::ARRAY);
                     self.read += 1;
                     continue;
                 }
                 // Disable COMM_2 and enable COMM_1 + VARIAB.
                 b'$' => {
                     self.bitflags.remove(ArgumentFlags::COMM_2);
-                    self.bitflags
-                        .insert(ArgumentFlags::COMM_1 | ArgumentFlags::VARIAB);
+                    self.bitflags.insert(ArgumentFlags::COMM_1 | ArgumentFlags::VARIAB);
                     self.read += 1;
                     continue;
                 }
@@ -96,12 +90,8 @@ impl<'a> Iterator for ArgumentSplitter<'a> {
                 b'(' => {
                     // Disable VARIAB + ARRAY and enable METHOD.
                     // if variab or array are set
-                    if self
-                        .bitflags
-                        .intersects(ArgumentFlags::VARIAB | ArgumentFlags::ARRAY)
-                    {
-                        self.bitflags
-                            .remove(ArgumentFlags::VARIAB | ArgumentFlags::ARRAY);
+                    if self.bitflags.intersects(ArgumentFlags::VARIAB | ArgumentFlags::ARRAY) {
+                        self.bitflags.remove(ArgumentFlags::VARIAB | ArgumentFlags::ARRAY);
                         self.bitflags.insert(ArgumentFlags::METHOD);
                     }
                     level += 1
@@ -125,10 +115,10 @@ impl<'a> Iterator for ArgumentSplitter<'a> {
                 }
                 // Break from the loop once a root-level space is found.
                 b' ' => {
-                    if !self
-                        .bitflags
-                        .intersects(ArgumentFlags::DOUBLE | ArgumentFlags::METHOD)
-                        && level == 0 && alevel == 0 && blevel == 0
+                    if !self.bitflags.intersects(ArgumentFlags::DOUBLE | ArgumentFlags::METHOD)
+                        && level == 0
+                        && alevel == 0
+                        && blevel == 0
                     {
                         break;
                     }
@@ -138,8 +128,7 @@ impl<'a> Iterator for ArgumentSplitter<'a> {
 
             self.read += 1;
             // disable COMM_1 and COMM_2
-            self.bitflags
-                .remove(ArgumentFlags::COMM_1 | ArgumentFlags::COMM_2);
+            self.bitflags.remove(ArgumentFlags::COMM_1 | ArgumentFlags::COMM_2);
         }
 
         if start == self.read {
@@ -179,22 +168,14 @@ mod tests {
     #[test]
     fn arrays() {
         let input = "echo [ one two @[echo three four] five ] [ six seven ]";
-        let expected = vec![
-            "echo",
-            "[ one two @[echo three four] five ]",
-            "[ six seven ]",
-        ];
+        let expected = vec!["echo", "[ one two @[echo three four] five ]", "[ six seven ]"];
         compare(input, expected);
     }
 
     #[test]
     fn quotes() {
         let input = "echo 'one two \"three four\"' \"five six 'seven eight'\"";
-        let expected = vec![
-            "echo",
-            "'one two \"three four\"'",
-            "\"five six 'seven eight'\"",
-        ];
+        let expected = vec!["echo", "'one two \"three four\"'", "\"five six 'seven eight'\""];
         compare(input, expected);
     }
 }
diff --git a/members/lexers/src/assignments/keys.rs b/members/lexers/src/assignments/keys.rs
index 398aca2a186c7e666a1445bd6b6445c01d0482d8..cd356474295f2df77adf21300944bfe0a51cc5b0 100644
--- a/members/lexers/src/assignments/keys.rs
+++ b/members/lexers/src/assignments/keys.rs
@@ -42,12 +42,7 @@ impl<'a> Key<'a> {
 }
 
 impl<'a> From<Key<'a>> for KeyBuf {
-    fn from(key: Key<'a>) -> KeyBuf {
-        KeyBuf {
-            kind: key.kind,
-            name: key.name.to_owned(),
-        }
-    }
+    fn from(key: Key<'a>) -> KeyBuf { KeyBuf { kind: key.kind, name: key.name.to_owned() } }
 }
 
 /// Quite simply, an iterator that returns keys.
@@ -93,7 +88,7 @@ impl<'a> KeyIterator<'a> {
                         None => {
                             break Err(TypeError::Invalid(
                                 self.data[index_ident_end + 1..self.read].into(),
-                            ))
+                            ));
                         }
                     },
                 };
@@ -142,7 +137,7 @@ impl<'a> Iterator for KeyIterator<'a> {
                     return Some(Ok(Key {
                         name: &self.data[start..self.read].trim(),
                         kind: Primitive::Any,
-                    }))
+                    }));
                 }
                 b':' => {
                     let end = self.read - 1;
@@ -158,10 +153,7 @@ impl<'a> Iterator for KeyIterator<'a> {
         if start == self.read {
             None
         } else {
-            Some(Ok(Key {
-                name: &self.data[start..self.read].trim(),
-                kind: Primitive::Any,
-            }))
+            Some(Ok(Key { name: &self.data[start..self.read].trim(), kind: Primitive::Any }))
         }
     }
 }
@@ -177,47 +169,14 @@ mod tests {
              k:hmap[int[]] l:hmap[hmap[bool[]]] m:bmap[] n:bmap[int] o:bmap[float[]] \
              p:bmap[hmap[bool]] d:a",
         );
+        assert_eq!(parser.next().unwrap(), Ok(Key { name: "a", kind: Primitive::Integer },));
+        assert_eq!(parser.next().unwrap(), Ok(Key { name: "b", kind: Primitive::AnyArray },));
+        assert_eq!(parser.next().unwrap(), Ok(Key { name: "c", kind: Primitive::Boolean },));
+        assert_eq!(parser.next().unwrap(), Ok(Key { name: "d", kind: Primitive::Any },));
+        assert_eq!(parser.next().unwrap(), Ok(Key { name: "e", kind: Primitive::IntegerArray },));
         assert_eq!(
             parser.next().unwrap(),
-            Ok(Key {
-                name: "a",
-                kind: Primitive::Integer,
-            },)
-        );
-        assert_eq!(
-            parser.next().unwrap(),
-            Ok(Key {
-                name: "b",
-                kind: Primitive::AnyArray,
-            },)
-        );
-        assert_eq!(
-            parser.next().unwrap(),
-            Ok(Key {
-                name: "c",
-                kind: Primitive::Boolean,
-            },)
-        );
-        assert_eq!(
-            parser.next().unwrap(),
-            Ok(Key {
-                name: "d",
-                kind: Primitive::Any,
-            },)
-        );
-        assert_eq!(
-            parser.next().unwrap(),
-            Ok(Key {
-                name: "e",
-                kind: Primitive::IntegerArray,
-            },)
-        );
-        assert_eq!(
-            parser.next().unwrap(),
-            Ok(Key {
-                name: "f",
-                kind: Primitive::Indexed("0".into(), Box::new(Primitive::Any)),
-            },)
+            Ok(Key { name: "f", kind: Primitive::Indexed("0".into(), Box::new(Primitive::Any)) },)
         );
         assert_eq!(
             parser.next().unwrap(),
@@ -235,24 +194,15 @@ mod tests {
         );
         assert_eq!(
             parser.next().unwrap(),
-            Ok(Key {
-                name: "i",
-                kind: Primitive::HashMap(Box::new(Primitive::Any)),
-            },)
+            Ok(Key { name: "i", kind: Primitive::HashMap(Box::new(Primitive::Any)) },)
         );
         assert_eq!(
             parser.next().unwrap(),
-            Ok(Key {
-                name: "j",
-                kind: Primitive::HashMap(Box::new(Primitive::Float)),
-            },)
+            Ok(Key { name: "j", kind: Primitive::HashMap(Box::new(Primitive::Float)) },)
         );
         assert_eq!(
             parser.next().unwrap(),
-            Ok(Key {
-                name: "k",
-                kind: Primitive::HashMap(Box::new(Primitive::IntegerArray)),
-            },)
+            Ok(Key { name: "k", kind: Primitive::HashMap(Box::new(Primitive::IntegerArray)) },)
         );
         assert_eq!(
             parser.next().unwrap(),
@@ -265,24 +215,15 @@ mod tests {
         );
         assert_eq!(
             parser.next().unwrap(),
-            Ok(Key {
-                name: "m",
-                kind: Primitive::BTreeMap(Box::new(Primitive::Any)),
-            },)
+            Ok(Key { name: "m", kind: Primitive::BTreeMap(Box::new(Primitive::Any)) },)
         );
         assert_eq!(
             parser.next().unwrap(),
-            Ok(Key {
-                name: "n",
-                kind: Primitive::BTreeMap(Box::new(Primitive::Integer)),
-            },)
+            Ok(Key { name: "n", kind: Primitive::BTreeMap(Box::new(Primitive::Integer)) },)
         );
         assert_eq!(
             parser.next().unwrap(),
-            Ok(Key {
-                name: "o",
-                kind: Primitive::BTreeMap(Box::new(Primitive::FloatArray)),
-            },)
+            Ok(Key { name: "o", kind: Primitive::BTreeMap(Box::new(Primitive::FloatArray)) },)
         );
         assert_eq!(
             parser.next().unwrap(),
diff --git a/members/lexers/src/assignments/mod.rs b/members/lexers/src/assignments/mod.rs
index c6dab3d7f9d1b01a8ff245b85fa71673031c64e9..0aa783e19e1ba4b1a17496aa80c2456e1c4a3d37 100644
--- a/members/lexers/src/assignments/mod.rs
+++ b/members/lexers/src/assignments/mod.rs
@@ -77,40 +77,22 @@ mod tests {
         assert_eq!(assignment_lexer(""), (None, None, None));
         assert_eq!(assignment_lexer("abc"), (Some("abc"), None, None));
 
-        assert_eq!(
-            assignment_lexer("abc+=def"),
-            (Some("abc"), Some(Operator::Add), Some("def"))
-        );
+        assert_eq!(assignment_lexer("abc+=def"), (Some("abc"), Some(Operator::Add), Some("def")));
 
-        assert_eq!(
-            assignment_lexer("a+=b"),
-            (Some("a"), Some(Operator::Add), Some("b"))
-        );
+        assert_eq!(assignment_lexer("a+=b"), (Some("a"), Some(Operator::Add), Some("b")));
 
-        assert_eq!(
-            assignment_lexer("a=b"),
-            (Some("a"), Some(Operator::Equal), Some("b"))
-        );
+        assert_eq!(assignment_lexer("a=b"), (Some("a"), Some(Operator::Equal), Some("b")));
 
-        assert_eq!(
-            assignment_lexer("abc ="),
-            (Some("abc"), Some(Operator::Equal), None)
-        );
+        assert_eq!(assignment_lexer("abc ="), (Some("abc"), Some(Operator::Equal), None));
 
-        assert_eq!(
-            assignment_lexer("abc =  "),
-            (Some("abc"), Some(Operator::Equal), None)
-        );
+        assert_eq!(assignment_lexer("abc =  "), (Some("abc"), Some(Operator::Equal), None));
 
         assert_eq!(
             assignment_lexer("abc = def"),
             (Some("abc"), Some(Operator::Equal), Some("def"))
         );
 
-        assert_eq!(
-            assignment_lexer("abc=def"),
-            (Some("abc"), Some(Operator::Equal), Some("def"))
-        );
+        assert_eq!(assignment_lexer("abc=def"), (Some("abc"), Some(Operator::Equal), Some("def")));
 
         assert_eq!(
             assignment_lexer("def ghi += 124 523"),
@@ -127,11 +109,7 @@ mod tests {
 
         assert_eq!(
             assignment_lexer("abc def ?= 123 456"),
-            (
-                Some("abc def"),
-                Some(Operator::OptionalEqual),
-                Some("123 456")
-            )
+            (Some("abc def"), Some(Operator::OptionalEqual), Some("123 456"))
         );
     }
 
@@ -147,10 +125,7 @@ mod tests {
             (Some("abc"), Some(Operator::Exponent), Some("def"))
         );
 
-        assert_eq!(
-            assignment_lexer("abc += def"),
-            (Some("abc"), Some(Operator::Add), Some("def"))
-        );
+        assert_eq!(assignment_lexer("abc += def"), (Some("abc"), Some(Operator::Add), Some("def")));
 
         assert_eq!(
             assignment_lexer("abc -= def"),
diff --git a/members/lexers/src/assignments/primitive.rs b/members/lexers/src/assignments/primitive.rs
index c81fccfcec5ddf4d81138b7f2174b86775a36a61..7d57da5ac5f5d3c22041acf7ed5422087781eac8 100644
--- a/members/lexers/src/assignments/primitive.rs
+++ b/members/lexers/src/assignments/primitive.rs
@@ -46,14 +46,10 @@ impl Primitive {
 
                 let res = if kind.starts_with("hmap[") {
                     let kind = &kind[5..];
-                    kind.rfind(']')
-                        .map(|found| &kind[..found])
-                        .and_then(parse_inner_hash_map)
+                    kind.rfind(']').map(|found| &kind[..found]).and_then(parse_inner_hash_map)
                 } else if kind.starts_with("bmap[") {
                     let kind = &kind[5..];
-                    kind.rfind(']')
-                        .map(|found| &kind[..found])
-                        .and_then(parse_inner_btree_map)
+                    kind.rfind(']').map(|found| &kind[..found]).and_then(parse_inner_btree_map)
                 } else {
                     None
                 };
diff --git a/members/lexers/src/designators.rs b/members/lexers/src/designators.rs
index 6f20cd2ea1735631b2e1b3b8ef0a832e6404b900..d2229c9035be06ba898afcf80844a8ad24823c0a 100644
--- a/members/lexers/src/designators.rs
+++ b/members/lexers/src/designators.rs
@@ -28,10 +28,7 @@ impl<'a> DesignatorLexer<'a> {
     }
 
     pub fn new(data: &'a [u8]) -> DesignatorLexer {
-        DesignatorLexer {
-            data,
-            flags: Flags::empty(),
-        }
+        DesignatorLexer { data, flags: Flags::empty() }
     }
 }
 
diff --git a/members/ranges/src/index.rs b/members/ranges/src/index.rs
index cb5015a5af1678bc2de8d2d03a88ccae4f485e0b..79eb448c24bc8eba692beab5321877f0e18f04d7 100644
--- a/members/ranges/src/index.rs
+++ b/members/ranges/src/index.rs
@@ -13,11 +13,8 @@ impl Index {
     pub fn resolve(&self, vector_length: usize) -> Option<usize> {
         match *self {
             Index::Forward(n) => Some(n),
-            Index::Backward(n) => if n >= vector_length {
-                None
-            } else {
-                Some(vector_length - (n + 1))
-            },
+            Index::Backward(n) if n >= vector_length => None,
+            Index::Backward(n) => Some(vector_length - (n + 1)),
         }
     }
 
@@ -25,7 +22,7 @@ impl Index {
     /// - A positive value `n` represents `Forward(n)`
     /// - A negative value `-n` reprents `Backwards(n - 1)` such that:
     /// ```ignore,rust
-    /// assert_eq!(Index::new(-1), Index::Backward(0)) 
+    /// assert_eq!(Index::new(-1), Index::Backward(0))
     /// ```
     pub fn new(input: isize) -> Index {
         if input < 0 {
diff --git a/members/ranges/src/lib.rs b/members/ranges/src/lib.rs
index 27487bca31779b7afd642cbb51810f02732e4057..bf6f020d53b6d0c9157a063f6cf95ad45c912bf9 100644
--- a/members/ranges/src/lib.rs
+++ b/members/ranges/src/lib.rs
@@ -24,30 +24,12 @@ mod tests {
     #[test]
     fn index_ranges() {
         let valid_cases = vec![
-            (
-                Range::exclusive(Index::Forward(0), Index::Forward(3)),
-                "0..3",
-            ),
-            (
-                Range::inclusive(Index::Forward(0), Index::Forward(2)),
-                "0...2",
-            ),
-            (
-                Range::inclusive(Index::Forward(0), Index::Forward(4)),
-                "0..=4",
-            ),
-            (
-                Range::inclusive(Index::Forward(2), Index::Backward(1)),
-                "2...-2",
-            ),
-            (
-                Range::inclusive(Index::Forward(0), Index::Backward(0)),
-                "0...-1",
-            ),
-            (
-                Range::exclusive(Index::Backward(2), Index::Backward(0)),
-                "-3..-1",
-            ),
+            (Range::exclusive(Index::Forward(0), Index::Forward(3)), "0..3"),
+            (Range::inclusive(Index::Forward(0), Index::Forward(2)), "0...2"),
+            (Range::inclusive(Index::Forward(0), Index::Forward(4)), "0..=4"),
+            (Range::inclusive(Index::Forward(2), Index::Backward(1)), "2...-2"),
+            (Range::inclusive(Index::Forward(0), Index::Backward(0)), "0...-1"),
+            (Range::exclusive(Index::Backward(2), Index::Backward(0)), "-3..-1"),
             (Range::from(Index::Backward(2)), "-3.."),
             (Range::to(Index::Forward(5)), "..5"),
         ];
@@ -63,97 +45,39 @@ mod tests {
         }
     }
 
-    #[test]
-    fn range_expand() {
-        if let Some(_) = parse_range("abc") {
-            panic!("parse_range() failed");
-        }
-
-        let actual: Vec<small::String> = parse_range("-3...3").unwrap().collect();
-        let expected: Vec<small::String> = vec![
-            "-3".into(),
-            "-2".into(),
-            "-1".into(),
-            "0".into(),
-            "1".into(),
-            "2".into(),
-            "3".into(),
-        ];
-
-        assert_eq!(actual, expected);
-
-        let actual: Vec<small::String> = parse_range("07...12").unwrap().collect();
-        let expected: Vec<small::String> = vec![
-            "07".into(),
-            "08".into(),
-            "09".into(),
-            "10".into(),
-            "11".into(),
-            "12".into(),
-        ];
-
-        assert_eq!(actual, expected);
-
-        let actual: Vec<small::String> = parse_range("-3...10").unwrap().collect();
-        let expected: Vec<small::String> = vec![
-            "-3".into(),
-            "-2".into(),
-            "-1".into(),
-            "0".into(),
-            "1".into(),
-            "2".into(),
-            "3".into(),
-            "4".into(),
-            "5".into(),
-            "6".into(),
-            "7".into(),
-            "8".into(),
-            "9".into(),
-            "10".into(),
-        ];
-
-        assert_eq!(actual, expected);
-
-        let actual: Vec<small::String> = parse_range("3...-3").unwrap().collect();
-        let expected: Vec<small::String> = vec![
-            "3".into(),
-            "2".into(),
-            "1".into(),
-            "0".into(),
-            "-1".into(),
-            "-2".into(),
-            "-3".into(),
-        ];
+    fn test_range<T: Iterator<Item = i8>>(range: &str, expected: T) {
+        let actual: Vec<small::String> = parse_range(range).unwrap().collect();
+        let expected: Vec<_> =
+            expected.map(|i| small::String::from_string(i.to_string())).collect();
 
         assert_eq!(actual, expected);
+    }
 
-        let actual: Vec<small::String> = parse_range("03...-3").unwrap().collect();
-        let expected: Vec<small::String> = vec![
-            "03".into(),
-            "02".into(),
-            "01".into(),
-            "00".into(),
-            "-1".into(),
-            "-2".into(),
-            "-3".into(),
-        ];
+    fn test_fixed_range<T: Iterator<Item = i8>>(range: &str, expected: T, digits: usize) {
+        let actual: Vec<small::String> = parse_range(range).unwrap().collect();
+        let expected: Vec<_> =
+            expected.map(|i| small::String::from_string(format!("{:01$}", i, digits))).collect();
 
         assert_eq!(actual, expected);
+    }
 
-        let actual: Vec<small::String> = parse_range("3...-03").unwrap().collect();
-        let also: Vec<small::String> = parse_range("3..=-03").unwrap().collect();
-        let expected: Vec<small::String> = vec![
-            "003".into(),
-            "002".into(),
-            "001".into(),
-            "000".into(),
-            "-01".into(),
-            "-02".into(),
-            "-03".into(),
-        ];
+    #[test]
+    fn range_expand() {
+        if let Some(_) = parse_range("abc") {
+            panic!("parse_range() failed");
+        }
 
-        assert_eq!(actual, expected);
-        assert_eq!(also, expected);
+        test_range("-3...3", -3..=3);
+        test_fixed_range("07...12", 7..=12, 2);
+        test_range("-3...10", -3..=10);
+        test_range("3...-3", (-3..=3).rev());
+        test_fixed_range("03...-3", (-3..=3).rev(), 2);
+        test_fixed_range("3...-03", (-3..=3).rev(), 3);
+        test_fixed_range("3..=-03", (-3..=3).rev(), 3);
+        test_range("-3..4", -3..4);
+        test_range("3..-4", (-3..4).rev());
+        test_range("-3...0", -3..=0);
+        test_range("-3..0", -3..0);
 
         let actual: Vec<small::String> = parse_range("a...c").unwrap().collect();
         let expected: Vec<small::String> = vec!["a".into(), "b".into(), "c".into()];
@@ -186,39 +110,5 @@ mod tests {
         let expected: Vec<small::String> = vec!["c".into(), "b".into()];
 
         assert_eq!(actual, expected);
-
-        let actual: Vec<small::String> = parse_range("-3..4").unwrap().collect();
-        let expected: Vec<small::String> = vec![
-            "-3".into(),
-            "-2".into(),
-            "-1".into(),
-            "0".into(),
-            "1".into(),
-            "2".into(),
-            "3".into(),
-        ];
-
-        assert_eq!(actual, expected);
-
-        let actual: Vec<small::String> = parse_range("3..-4").unwrap().collect();
-        let expected: Vec<small::String> = vec![
-            "3".into(),
-            "2".into(),
-            "1".into(),
-            "0".into(),
-            "-1".into(),
-            "-2".into(),
-            "-3".into(),
-        ];
-
-        assert_eq!(actual, expected);
-
-        let actual: Vec<small::String> = parse_range("-3...0").unwrap().collect();
-        let expected: Vec<small::String> = vec!["-3".into(), "-2".into(), "-1".into(), "0".into()];
-        assert_eq!(actual, expected);
-
-        let actual: Vec<small::String> = parse_range("-3..0").unwrap().collect();
-        let expected: Vec<small::String> = vec!["-3".into(), "-2".into(), "-1".into()];
-        assert_eq!(actual, expected);
     }
 }
diff --git a/members/ranges/src/parse.rs b/members/ranges/src/parse.rs
index 0dd832c29a413d43156b3055ce16b721e7187df1..6f432ddb885d6fb411bf47038d2c22edee876fc1 100644
--- a/members/ranges/src/parse.rs
+++ b/members/ranges/src/parse.rs
@@ -118,9 +118,7 @@ fn char_range<'a>(
         }
         stepped_range_chars(start, end, char_step)
     } else {
-        Some(Box::new(
-            Some((start as char).to_string().into()).into_iter(),
-        ))
+        Some(Box::new(Some((start as char).to_string().into()).into_iter()))
     }
 }
 
@@ -196,8 +194,7 @@ pub fn parse_range(input: &str) -> Option<Box<Iterator<Item = small::String>>> {
                 macro_rules! finish {
                     ($inclusive:expr, $read:expr) => {
                         let end_str = &input[$read..];
-                        if let Some((start, end, nb_digits)) = strings_to_isizes(first, end_str)
-                        {
+                        if let Some((start, end, nb_digits)) = strings_to_isizes(first, end_str) {
                             return numeric_range(
                                 start,
                                 end,
@@ -211,8 +208,7 @@ pub fn parse_range(input: &str) -> Option<Box<Iterator<Item = small::String>>> {
                     };
                     ($inclusive:expr, $read:expr, $step:expr) => {
                         let end_str = &input[$read..];
-                        if let Some((start, end, nb_digits)) = strings_to_isizes(first, end_str)
-                        {
+                        if let Some((start, end, nb_digits)) = strings_to_isizes(first, end_str) {
                             return numeric_range(start, end, $step, $inclusive, nb_digits);
                         } else {
                             finish_char!($inclusive, end_str, $step);
@@ -301,8 +297,7 @@ pub fn parse_index_range(input: &str) -> Option<Range> {
                     break;
                 }
 
-                let inclusive = dots == 3
-                    || (dots == 2 && last_byte == b'=');
+                let inclusive = dots == 3 || (dots == 2 && last_byte == b'=');
 
                 let end = &input[id + if inclusive { 3 } else { 2 }..];
 
@@ -313,16 +308,18 @@ pub fn parse_index_range(input: &str) -> Option<Range> {
                         end.parse::<isize>().map(|end| Range::to(Index::new(end))).ok()
                     };
                 } else if end.is_empty() {
-                    return first.parse::<isize>()
-                        .map(|start| Range::from(Index::new(start))).ok();
+                    return first.parse::<isize>().map(|start| Range::from(Index::new(start))).ok();
                 }
 
-                return first.parse::<isize>()
+                return first
+                    .parse::<isize>()
                     .and_then(|start| end.parse::<isize>().map(|end| (start, end)))
-                    .map(|(start, end)| if inclusive {
-                        Range::inclusive(Index::new(start), Index::new(end))
-                    } else {
-                        Range::exclusive(Index::new(start), Index::new(end))
+                    .map(|(start, end)| {
+                        if inclusive {
+                            Range::inclusive(Index::new(start), Index::new(end))
+                        } else {
+                            Range::exclusive(Index::new(start), Index::new(end))
+                        }
                     })
                     .ok();
             }
diff --git a/members/ranges/src/range.rs b/members/ranges/src/range.rs
index 5bdb9e8ccd11f6840f332e0b4ab48b6f4b5cccdd..8436c2d9ff27f44e230b9a404bbf066f2290a04a 100644
--- a/members/ranges/src/range.rs
+++ b/members/ranges/src/range.rs
@@ -42,35 +42,11 @@ impl Range {
         }
     }
 
-    pub fn exclusive(start: Index, end: Index) -> Range {
-        Range {
-            start,
-            end,
-            inclusive: false,
-        }
-    }
+    pub fn exclusive(start: Index, end: Index) -> Range { Range { start, end, inclusive: false } }
 
-    pub fn inclusive(start: Index, end: Index) -> Range {
-        Range {
-            start,
-            end,
-            inclusive: true,
-        }
-    }
+    pub fn inclusive(start: Index, end: Index) -> Range { Range { start, end, inclusive: true } }
 
-    pub fn from(start: Index) -> Range {
-        Range {
-            start,
-            end: Index::new(-1),
-            inclusive: true,
-        }
-    }
+    pub fn from(start: Index) -> Range { Range { start, end: Index::new(-1), inclusive: true } }
 
-    pub fn to(end: Index) -> Range {
-        Range {
-            start: Index::new(0),
-            end,
-            inclusive: false,
-        }
-    }
+    pub fn to(end: Index) -> Range { Range { start: Index::new(0), end, inclusive: false } }
 }
diff --git a/members/ranges/src/select.rs b/members/ranges/src/select.rs
index d5b98055066e4e7cb255bed19f434ab788ab5f9c..4e33b7f08d04b951b6bbfe6a319c27a6fa467237 100644
--- a/members/ranges/src/select.rs
+++ b/members/ranges/src/select.rs
@@ -40,17 +40,14 @@ where
         match s {
             Select::None => empty().collect(),
             Select::All => self.collect(),
-            Select::Index(idx) => idx
-                .resolve(size)
-                .and_then(|idx| self.nth(idx))
-                .into_iter()
-                .collect(),
-            Select::Range(range) => if let Some((start, length)) = range.bounds(size) {
-                self.skip(start).take(length).collect()
-            } else {
-                empty().collect()
-            },
-            Select::Key(_) => empty().collect(),
+            Select::Index(idx) => {
+                idx.resolve(size).and_then(|idx| self.nth(idx)).into_iter().collect()
+            }
+            Select::Range(range) if range.bounds(size).is_some() => range
+                .bounds(size)
+                .map(|(start, length)| self.skip(start).take(length).collect())
+                .unwrap(),
+            _ => empty().collect(),
         }
     }
 }
diff --git a/members/sys/src/sys/redox/mod.rs b/members/sys/src/sys/redox/mod.rs
index ba244832439db863dd41acb95e2c0c7c734b4e02..600da97a2ac638805a264da4bce7619b356fb729 100644
--- a/members/sys/src/sys/redox/mod.rs
+++ b/members/sys/src/sys/redox/mod.rs
@@ -7,7 +7,11 @@ use std::{
     fs::File,
     io::{self, prelude::*, BufReader, SeekFrom},
     mem,
-    os::unix::{ffi::OsStrExt, fs::MetadataExt, io::{AsRawFd, RawFd}},
+    os::unix::{
+        ffi::OsStrExt,
+        fs::MetadataExt,
+        io::{AsRawFd, RawFd},
+    },
     path::PathBuf,
     process::exit,
     slice,
@@ -69,10 +73,7 @@ pub fn waitpid(pid: i32, status: &mut i32, options: i32) -> Result<i32, i32> {
 }
 
 pub fn strerror(errno: i32) -> &'static str {
-    syscall::error::STR_ERROR
-        .get(errno as usize)
-        .map(|err| *err)
-        .unwrap_or("Unknown Error")
+    syscall::error::STR_ERROR.get(errno as usize).map(|err| *err).unwrap_or("Unknown Error")
 }
 
 pub fn getpid() -> io::Result<u32> { cvt(syscall::getpid()).map(|pid| pid as u32) }
@@ -175,7 +176,7 @@ pub fn execve<S: AsRef<str>>(prog: &str, args: &[S], clear_env: bool) -> io::Err
     if let Some(prog) = prog {
         let mut file = match File::open(&prog) {
             Ok(file) => file,
-            Err(err) => return err
+            Err(err) => return err,
         };
 
         // Construct a valid set of arguments to pass to execve. Ensure that
@@ -195,7 +196,7 @@ pub fn execve<S: AsRef<str>>(prog: &str, args: &[S], clear_env: bool) -> io::Err
                 match reader.read(&mut shebang[read..]) {
                     Ok(0) => break,
                     Ok(n) => read += n,
-                    Err(err) => return err
+                    Err(err) => return err,
                 }
             }
 
@@ -205,21 +206,21 @@ pub fn execve<S: AsRef<str>>(prog: &str, args: &[S], clear_env: bool) -> io::Err
                 // we need to make sure ourselves the file is executable
                 let metadata = match file.metadata() {
                     Ok(meta) => meta,
-                    Err(err) => return err
+                    Err(err) => return err,
                 };
 
                 let uid = match syscall::getuid() {
                     Ok(uid) => uid,
-                    Err(err) => return io::Error::from_raw_os_error(err.errno)
+                    Err(err) => return io::Error::from_raw_os_error(err.errno),
                 };
                 let gid = match syscall::getgid() {
                     Ok(gid) => gid,
-                    Err(err) => return io::Error::from_raw_os_error(err.errno)
+                    Err(err) => return io::Error::from_raw_os_error(err.errno),
                 };
                 let mode = if uid == metadata.uid() as usize {
-                    (metadata.mode() >> 3*2) & 0o7
+                    (metadata.mode() >> 3 * 2) & 0o7
                 } else if gid == metadata.gid() as usize {
-                    (metadata.mode() >> 3*1) & 0o7
+                    (metadata.mode() >> 3 * 1) & 0o7
                 } else {
                     metadata.mode() & 0o7
                 };
@@ -240,13 +241,13 @@ pub fn execve<S: AsRef<str>>(prog: &str, args: &[S], clear_env: bool) -> io::Err
                         // (But remember to make sure the vector lives long
                         // enough for the arguments!!)
                         Some(interpreter)
-                    },
-                    Err(err) => return err
+                    }
+                    Err(err) => return err,
                 }
             } else {
                 match reader.seek(SeekFrom::Start(0)) {
                     Ok(_) => (),
-                    Err(err) => return err
+                    Err(err) => return err,
                 }
                 None
             }
@@ -255,7 +256,7 @@ pub fn execve<S: AsRef<str>>(prog: &str, args: &[S], clear_env: bool) -> io::Err
             let path: &OsStr = OsStrExt::from_bytes(&interpreter);
             file = match File::open(path) {
                 Ok(file) => file,
-                Err(err) => return err
+                Err(err) => return err,
             };
             cvt_args.push([interpreter.as_ptr() as usize, interpreter.len()]);
         }
@@ -315,10 +316,7 @@ pub fn tcsetpgrp(tty_fd: RawFd, pgid: u32) -> io::Result<()> {
 
     let pgid_usize = pgid as usize;
     let res = syscall::write(fd, unsafe {
-        slice::from_raw_parts(
-            &pgid_usize as *const usize as *const u8,
-            mem::size_of::<usize>(),
-        )
+        slice::from_raw_parts(&pgid_usize as *const usize as *const u8, mem::size_of::<usize>())
     });
 
     let _ = syscall::close(fd);
@@ -370,10 +368,7 @@ pub mod variables {
         if unsafe { libc::gethostname(&mut host_name as *mut _ as *mut c_char, host_name.len()) }
             == 0
         {
-            let len = host_name
-                .iter()
-                .position(|i| *i == 0)
-                .unwrap_or(host_name.len());
+            let len = host_name.iter().position(|i| *i == 0).unwrap_or(host_name.len());
 
             Some(unsafe { String::from_utf8_unchecked(host_name[..len].to_owned()) })
         } else {
diff --git a/members/sys/src/sys/unix/mod.rs b/members/sys/src/sys/unix/mod.rs
index eb4576fc65e49a54e2583ff98615ae48270237f3..f7770bd3931fe01326dde1de5b3b63e05dcaf7cf 100644
--- a/members/sys/src/sys/unix/mod.rs
+++ b/members/sys/src/sys/unix/mod.rs
@@ -1,6 +1,6 @@
-extern crate libc;
 #[cfg(target_os = "dragonfly")]
 extern crate errno_dragonfly;
+extern crate libc;
 
 pub mod signals;
 
@@ -40,26 +40,14 @@ pub const STDIN_FILENO: i32 = libc::STDIN_FILENO;
 #[cfg(target_os = "linux")]
 fn errno() -> i32 { unsafe { *libc::__errno_location() } }
 
-#[cfg(
-    any(
-        target_os = "openbsd",
-        target_os = "bitrig",
-        target_os = "android"
-    )
-)]
+#[cfg(any(target_os = "openbsd", target_os = "bitrig", target_os = "android"))]
 fn errno() -> i32 { unsafe { *libc::__errno() } }
 
-#[cfg(
-    any(
-        target_os = "macos",
-        target_os = "ios",
-        target_os = "freebsd"
-    )
-)]
+#[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd"))]
 fn errno() -> i32 { unsafe { *libc::__error() } }
 
 #[cfg(target_os = "dragonfly")]
-fn errno() -> i32 { unsafe { *errno_dragonfly::errno_location()} }
+fn errno() -> i32 { unsafe { *errno_dragonfly::errno_location() } }
 
 pub fn strerror(errno: i32) -> &'static str {
     unsafe {
@@ -383,10 +371,7 @@ pub mod variables {
         if unsafe { libc::gethostname(&mut host_name as *mut _ as *mut c_char, host_name.len()) }
             == 0
         {
-            let len = host_name
-                .iter()
-                .position(|i| *i == 0)
-                .unwrap_or_else(|| host_name.len());
+            let len = host_name.iter().position(|i| *i == 0).unwrap_or_else(|| host_name.len());
 
             Some(unsafe { String::from_utf8_unchecked(host_name[..len].to_owned()) })
         } else {
@@ -407,27 +392,11 @@ pub mod env {
     };
 
     pub fn home_dir() -> Option<PathBuf> {
-        return env::var_os("HOME")
-            .or_else(|| unsafe { fallback() })
-            .map(PathBuf::from);
-
-        #[cfg(
-            any(
-                target_os = "android",
-                target_os = "ios",
-                target_os = "emscripten"
-            )
-        )]
+        return env::var_os("HOME").or_else(|| unsafe { fallback() }).map(PathBuf::from);
+
+        #[cfg(any(target_os = "android", target_os = "ios", target_os = "emscripten"))]
         unsafe fn fallback() -> Option<OsString> { None }
-        #[cfg(
-            not(
-                any(
-                    target_os = "android",
-                    target_os = "ios",
-                    target_os = "emscripten"
-                )
-            )
-        )]
+        #[cfg(not(any(target_os = "android", target_os = "ios", target_os = "emscripten")))]
         unsafe fn fallback() -> Option<OsString> {
             let amt = match libc::sysconf(libc::_SC_GETPW_R_SIZE_MAX) {
                 n if n < 0 => 512 as usize,
diff --git a/members/sys/src/sys/unix/signals.rs b/members/sys/src/sys/unix/signals.rs
index ba4166e3618932e312df4da2853b541c20be897c..00a80262371f3655c29bf725c75e12a03e50339f 100644
--- a/members/sys/src/sys/unix/signals.rs
+++ b/members/sys/src/sys/unix/signals.rs
@@ -11,11 +11,7 @@ pub fn block() {
         sigaddset(&mut sigset as *mut sigset_t, SIGTTOU);
         sigaddset(&mut sigset as *mut sigset_t, SIGTTIN);
         sigaddset(&mut sigset as *mut sigset_t, SIGCHLD);
-        sigprocmask(
-            SIG_BLOCK,
-            &sigset as *const sigset_t,
-            ptr::null_mut() as *mut sigset_t,
-        );
+        sigprocmask(SIG_BLOCK, &sigset as *const sigset_t, ptr::null_mut() as *mut sigset_t);
     }
 }
 
@@ -30,10 +26,6 @@ pub fn unblock() {
         sigaddset(&mut sigset as *mut sigset_t, SIGTTOU);
         sigaddset(&mut sigset as *mut sigset_t, SIGTTIN);
         sigaddset(&mut sigset as *mut sigset_t, SIGCHLD);
-        sigprocmask(
-            SIG_UNBLOCK,
-            &sigset as *const sigset_t,
-            ptr::null_mut() as *mut sigset_t,
-        );
+        sigprocmask(SIG_UNBLOCK, &sigset as *const sigset_t, ptr::null_mut() as *mut sigset_t);
     }
 }
diff --git a/rustfmt.toml b/rustfmt.toml
index d6df6d666ef220b30aeef1c53da2d0c72bd0b750..44c3d28515823efd7f066e57d9a12918075be4c6 100644
--- a/rustfmt.toml
+++ b/rustfmt.toml
@@ -13,3 +13,5 @@ struct_field_align_threshold = 30
 use_field_init_shorthand = true
 wrap_comments = true
 merge_imports = true
+force_multiline_blocks = false
+use_small_heuristics = "Max"
diff --git a/src/lib/ascii_helpers.rs b/src/lib/ascii_helpers.rs
index b612c28945f99c48c548993bce802b347d681165..e40d1d80579dd8add7276a90d4e6dc1ff911692a 100644
--- a/src/lib/ascii_helpers.rs
+++ b/src/lib/ascii_helpers.rs
@@ -22,10 +22,7 @@ impl AsciiReplaceInPlace for str {
     // I tried replacing these `assert!` calls with `debug_assert!` but it looks
     // like they get const-folded away anyway since it doesn't affect the speed
     fn ascii_replace_in_place(&mut self, needle: char, haystack: char) {
-        assert!(
-            needle.is_ascii(),
-            "AsciiReplace functions can only be used for ascii characters"
-        );
+        assert!(needle.is_ascii(), "AsciiReplace functions can only be used for ascii characters");
         assert!(
             haystack.is_ascii(),
             "AsciiReplace functions can only be used for ascii characters"
diff --git a/src/lib/builtins/command_info.rs b/src/lib/builtins/command_info.rs
index 235859b566cdd8c0cb81a2fcbafc5bfe696ea8b8..992c12b67fbc8099f33b66e12592eec0f28770a0 100644
--- a/src/lib/builtins/command_info.rs
+++ b/src/lib/builtins/command_info.rs
@@ -19,16 +19,16 @@ pub(crate) fn which(args: &[small::String], shell: &mut Shell) -> Result<i32, ()
     let mut result = SUCCESS;
     for command in &args[1..] {
         match get_command_info(command, shell) {
-            Ok(c_type) =>  {
-                match c_type.as_ref() {
-                    "alias" => if let Some(alias) = shell.variables.get::<types::Alias>(&**command) {
+            Ok(c_type) => match c_type.as_ref() {
+                "alias" => {
+                    if let Some(alias) = shell.variables.get::<types::Alias>(&**command) {
                         println!("{}: alias to {}", command, &*alias);
-                    },
-                    "function" => println!("{}: function", command),
-                    "builtin" => println!("{}: built-in shell command", command),
-                    _path => println!("{}", _path),
+                    }
                 }
-            }
+                "function" => println!("{}: function", command),
+                "builtin" => println!("{}: built-in shell command", command),
+                _path => println!("{}", _path),
+            },
             Err(_) => result = FAILURE,
         }
     }
@@ -47,9 +47,11 @@ pub(crate) fn find_type(args: &[small::String], shell: &mut Shell) -> Result<i32
         match get_command_info(command, shell) {
             Ok(c_type) => {
                 match c_type.as_ref() {
-                    "alias" => if let Some(alias) = shell.variables.get::<types::Alias>(&**command) {
-                        println!("{} is aliased to `{}`", command, &*alias);
-                    },
+                    "alias" => {
+                        if let Some(alias) = shell.variables.get::<types::Alias>(&**command) {
+                            println!("{} is aliased to `{}`", command, &*alias);
+                        }
+                    }
                     // TODO Make it print the function.
                     "function" => println!("{} is a function", command),
                     "builtin" => println!("{} is a shell builtin", command),
@@ -71,9 +73,8 @@ pub(crate) fn get_command_info<'a>(command: &str, shell: &mut Shell) -> Result<C
     } else if shell.builtins.contains_key(command) {
         return Ok("builtin".into());
     } else {
-        for path in env::var("PATH")
-            .unwrap_or_else(|_| String::from("/bin"))
-            .split(sys::PATH_SEPARATOR)
+        for path in
+            env::var("PATH").unwrap_or_else(|_| String::from("/bin")).split(sys::PATH_SEPARATOR)
         {
             let executable = Path::new(path).join(command);
             if executable.is_file() {
diff --git a/src/lib/builtins/exec.rs b/src/lib/builtins/exec.rs
index 29fe57eb984fc515e9b64f2712b9a949cbb848a1..100c9d8ad9c0a2d0f409458b883dae69e55e34c4 100644
--- a/src/lib/builtins/exec.rs
+++ b/src/lib/builtins/exec.rs
@@ -23,15 +23,9 @@ pub(crate) fn exec(shell: &mut Shell, args: &[small::String]) -> Result<(), smal
 
     match args.get(idx) {
         Some(argument) => {
-            let args = if args.len() > idx + 1 {
-                &args[idx + 1..]
-            } else {
-                &[]
-            };
+            let args = if args.len() > idx + 1 { &args[idx + 1..] } else { &[] };
             shell.prep_for_exit();
-            Err(execve(argument, args, (flags & CLEAR_ENV) == 1)
-                .description()
-                .into())
+            Err(execve(argument, args, (flags & CLEAR_ENV) == 1).description().into())
         }
         None => Err("no command provided".into()),
     }
diff --git a/src/lib/builtins/exists.rs b/src/lib/builtins/exists.rs
index 566328fbfbb90a4869cd85c082004e39e4db4154..e3b82572aa7fd24b9903145f5626f17991dd6a62 100644
--- a/src/lib/builtins/exists.rs
+++ b/src/lib/builtins/exists.rs
@@ -65,16 +65,12 @@ fn match_option_argument(option: &str, argument: &str, shell: &Shell) -> bool {
 
 /// Returns true if the file is a regular file
 fn path_is_file(filepath: &str) -> bool {
-    fs::metadata(filepath)
-        .ok()
-        .map_or(false, |metadata| metadata.file_type().is_file())
+    fs::metadata(filepath).ok().map_or(false, |metadata| metadata.file_type().is_file())
 }
 
 /// Returns true if the file is a directory
 fn path_is_directory(filepath: &str) -> bool {
-    fs::metadata(filepath)
-        .ok()
-        .map_or(false, |metadata| metadata.file_type().is_dir())
+    fs::metadata(filepath).ok().map_or(false, |metadata| metadata.file_type().is_dir())
 }
 
 /// Returns true if the binary is found in path (and is executable)
@@ -109,7 +105,9 @@ fn file_has_execute_permission(filepath: &str) -> bool {
     const GUEST: u32 = 0b1;
 
     // Collect the mode of permissions for the file
-    fs::metadata(filepath).map(|metadata| metadata.permissions().mode()).ok()
+    fs::metadata(filepath)
+        .map(|metadata| metadata.permissions().mode())
+        .ok()
         // If the mode is equal to any of the above, return `SUCCESS`
         .map_or(false, |mode| mode & (USER + GROUP + GUEST) != 0)
 }
@@ -135,10 +133,7 @@ fn string_var_is_not_empty(stringvar: &str, shell: &Shell) -> bool {
 
 /// Returns true if a function with the given name is defined
 fn function_is_defined(function: &str, shell: &Shell) -> bool {
-    match shell.variables.get::<Function>(function) {
-        Some(_) => true,
-        None => false,
-    }
+    shell.variables.get::<Function>(function).is_some()
 }
 
 #[test]
@@ -151,43 +146,25 @@ fn test_evaluate_arguments() {
     assert_eq!(evaluate_arguments(&[], &shell), Ok(false));
     // multiple arguments
     // ignores all but the first argument
-    assert_eq!(
-        evaluate_arguments(&["foo".into(), "bar".into()], &shell),
-        Ok(true)
-    );
+    assert_eq!(evaluate_arguments(&["foo".into(), "bar".into()], &shell), Ok(true));
 
     // check `exists STRING`
     assert_eq!(evaluate_arguments(&["".into()], &shell), Ok(false));
     assert_eq!(evaluate_arguments(&["string".into()], &shell), Ok(true));
-    assert_eq!(
-        evaluate_arguments(&["string with space".into()], &shell),
-        Ok(true)
-    );
-    assert_eq!(
-        evaluate_arguments(&["-startswithdash".into()], &shell),
-        Ok(true)
-    );
+    assert_eq!(evaluate_arguments(&["string with space".into()], &shell), Ok(true));
+    assert_eq!(evaluate_arguments(&["-startswithdash".into()], &shell), Ok(true));
 
     // check `exists -a`
     // no argument means we treat it as a string
     assert_eq!(evaluate_arguments(&["-a".into()], &shell), Ok(true));
     shell.variables.set("emptyarray", types::Array::new());
-    assert_eq!(
-        evaluate_arguments(&["-a".into(), "emptyarray".into()], &shell),
-        Ok(false)
-    );
+    assert_eq!(evaluate_arguments(&["-a".into(), "emptyarray".into()], &shell), Ok(false));
     let mut array = types::Array::new();
     array.push("element".into());
     shell.variables.set("array", array);
-    assert_eq!(
-        evaluate_arguments(&["-a".into(), "array".into()], &shell),
-        Ok(true)
-    );
+    assert_eq!(evaluate_arguments(&["-a".into(), "array".into()], &shell), Ok(true));
     shell.variables.remove_variable("array");
-    assert_eq!(
-        evaluate_arguments(&["-a".into(), "array".into()], &shell),
-        Ok(false)
-    );
+    assert_eq!(evaluate_arguments(&["-a".into(), "array".into()], &shell), Ok(false));
 
     // check `exists -b`
     // TODO: see test_binary_is_in_path()
@@ -196,18 +173,9 @@ fn test_evaluate_arguments() {
     let oldpath = shell.get::<types::Str>("PATH").unwrap_or_else(|| "/usr/bin".into());
     shell.set("PATH", "testing/");
 
-    assert_eq!(
-        evaluate_arguments(&["-b".into(), "executable_file".into()], &shell),
-        Ok(true)
-    );
-    assert_eq!(
-        evaluate_arguments(&["-b".into(), "empty_file".into()], &shell),
-        Ok(false)
-    );
-    assert_eq!(
-        evaluate_arguments(&["-b".into(), "file_does_not_exist".into()], &shell),
-        Ok(false)
-    );
+    assert_eq!(evaluate_arguments(&["-b".into(), "executable_file".into()], &shell), Ok(true));
+    assert_eq!(evaluate_arguments(&["-b".into(), "empty_file".into()], &shell), Ok(false));
+    assert_eq!(evaluate_arguments(&["-b".into(), "file_does_not_exist".into()], &shell), Ok(false));
 
     // restore original PATH. Not necessary for the currently defined test cases
     // but this might change in the future? Better safe than sorry!
@@ -216,89 +184,47 @@ fn test_evaluate_arguments() {
     // check `exists -d`
     // no argument means we treat it as a string
     assert_eq!(evaluate_arguments(&["-d".into()], &shell), Ok(true));
-    assert_eq!(
-        evaluate_arguments(&["-d".into(), "testing/".into()], &shell),
-        Ok(true)
-    );
-    assert_eq!(
-        evaluate_arguments(&["-d".into(), "testing/empty_file".into()], &shell),
-        Ok(false)
-    );
-    assert_eq!(
-        evaluate_arguments(&["-d".into(), "does/not/exist/".into()], &shell),
-        Ok(false)
-    );
+    assert_eq!(evaluate_arguments(&["-d".into(), "testing/".into()], &shell), Ok(true));
+    assert_eq!(evaluate_arguments(&["-d".into(), "testing/empty_file".into()], &shell), Ok(false));
+    assert_eq!(evaluate_arguments(&["-d".into(), "does/not/exist/".into()], &shell), Ok(false));
 
     // check `exists -f`
     // no argument means we treat it as a string
     assert_eq!(evaluate_arguments(&["-f".into()], &shell), Ok(true));
-    assert_eq!(
-        evaluate_arguments(&["-f".into(), "testing/".into()], &shell),
-        Ok(false)
-    );
-    assert_eq!(
-        evaluate_arguments(&["-f".into(), "testing/empty_file".into()], &shell),
-        Ok(true)
-    );
-    assert_eq!(
-        evaluate_arguments(&["-f".into(), "does-not-exist".into()], &shell),
-        Ok(false)
-    );
+    assert_eq!(evaluate_arguments(&["-f".into(), "testing/".into()], &shell), Ok(false));
+    assert_eq!(evaluate_arguments(&["-f".into(), "testing/empty_file".into()], &shell), Ok(true));
+    assert_eq!(evaluate_arguments(&["-f".into(), "does-not-exist".into()], &shell), Ok(false));
 
     // check `exists -s`
     // no argument means we treat it as a string
     assert_eq!(evaluate_arguments(&["-s".into()], &shell), Ok(true));
     shell.set("emptyvar", "".to_string());
-    assert_eq!(
-        evaluate_arguments(&["-s".into(), "emptyvar".into()], &shell),
-        Ok(false)
-    );
+    assert_eq!(evaluate_arguments(&["-s".into(), "emptyvar".into()], &shell), Ok(false));
     shell.set("testvar", "foobar".to_string());
-    assert_eq!(
-        evaluate_arguments(&["-s".into(), "testvar".into()], &shell),
-        Ok(true)
-    );
+    assert_eq!(evaluate_arguments(&["-s".into(), "testvar".into()], &shell), Ok(true));
     shell.variables.remove_variable("testvar");
-    assert_eq!(
-        evaluate_arguments(&["-s".into(), "testvar".into()], &shell),
-        Ok(false)
-    );
+    assert_eq!(evaluate_arguments(&["-s".into(), "testvar".into()], &shell), Ok(false));
     // also check that it doesn't trigger on arrays
     let mut array = types::Array::new();
     array.push("element".into());
     shell.variables.remove_variable("array");
     shell.variables.set("array", array);
-    assert_eq!(
-        evaluate_arguments(&["-s".into(), "array".into()], &shell),
-        Ok(false)
-    );
+    assert_eq!(evaluate_arguments(&["-s".into(), "array".into()], &shell), Ok(false));
 
     // check `exists --fn`
     let name_str = "test_function";
     let name = small::String::from(name_str);
     let mut args = Vec::new();
-    args.push(KeyBuf {
-        name: "testy".into(),
-        kind: Primitive::Any,
-    });
+    args.push(KeyBuf { name: "testy".into(), kind: Primitive::Any });
     let mut statements = Vec::new();
     statements.push(Statement::End);
     let description: small::String = "description".into();
 
-    shell.variables.set(
-        &name,
-        Function::new(Some(description), name.clone(), args, statements),
-    );
+    shell.variables.set(&name, Function::new(Some(description), name.clone(), args, statements));
 
-    assert_eq!(
-        evaluate_arguments(&["--fn".into(), name_str.into()], &shell),
-        Ok(true)
-    );
+    assert_eq!(evaluate_arguments(&["--fn".into(), name_str.into()], &shell), Ok(true));
     shell.variables.remove_variable(name_str);
-    assert_eq!(
-        evaluate_arguments(&["--fn".into(), name_str.into()], &shell),
-        Ok(false)
-    );
+    assert_eq!(evaluate_arguments(&["--fn".into(), name_str.into()], &shell), Ok(false));
 
     // check invalid flags / parameters (should all be treated as strings and
     // therefore succeed)
@@ -312,26 +238,11 @@ fn test_match_flag_argument() {
 
     // we don't really care about the passed values, as long as both sited return
     // the same value
-    assert_eq!(
-        match_flag_argument('a', "ARRAY", &shell),
-        array_var_is_not_empty("ARRAY", &shell)
-    );
-    assert_eq!(
-        match_flag_argument('b', "binary", &shell),
-        binary_is_in_path("binary", &shell)
-    );
-    assert_eq!(
-        match_flag_argument('d', "path", &shell),
-        path_is_directory("path")
-    );
-    assert_eq!(
-        match_flag_argument('f', "file", &shell),
-        path_is_file("file")
-    );
-    assert_eq!(
-        match_flag_argument('s', "STR", &shell),
-        string_var_is_not_empty("STR", &shell)
-    );
+    assert_eq!(match_flag_argument('a', "ARRAY", &shell), array_var_is_not_empty("ARRAY", &shell));
+    assert_eq!(match_flag_argument('b', "binary", &shell), binary_is_in_path("binary", &shell));
+    assert_eq!(match_flag_argument('d', "path", &shell), path_is_directory("path"));
+    assert_eq!(match_flag_argument('f', "file", &shell), path_is_file("file"));
+    assert_eq!(match_flag_argument('s', "STR", &shell), string_var_is_not_empty("STR", &shell));
 
     // Any flag which is not implemented
     assert_eq!(match_flag_argument('x', "ARG", &shell), false);
@@ -343,10 +254,7 @@ fn test_match_option_argument() {
 
     // we don't really care about the passed values, as long as both sited return
     // the same value
-    assert_eq!(
-        match_option_argument("fn", "FUN", &shell),
-        array_var_is_not_empty("FUN", &shell)
-    );
+    assert_eq!(match_option_argument("fn", "FUN", &shell), array_var_is_not_empty("FUN", &shell));
 
     // Any option which is not implemented
     assert_eq!(match_option_argument("foo", "ARG", &shell), false);
@@ -447,18 +355,12 @@ fn test_function_is_defined() {
     let name_str = "test_function";
     let name: small::String = name_str.into();
     let mut args = Vec::new();
-    args.push(KeyBuf {
-        name: "testy".into(),
-        kind: Primitive::Any,
-    });
+    args.push(KeyBuf { name: "testy".into(), kind: Primitive::Any });
     let mut statements = Vec::new();
     statements.push(Statement::End);
     let description: small::String = "description".into();
 
-    shell.variables.set(
-        &name,
-        Function::new(Some(description), name.clone(), args, statements),
-    );
+    shell.variables.set(&name, Function::new(Some(description), name.clone(), args, statements));
 
     assert_eq!(function_is_defined(name_str, &shell), true);
     shell.variables.remove_variable(name_str);
diff --git a/src/lib/builtins/is.rs b/src/lib/builtins/is.rs
index a84771f6b5e6c44e9afcd1ee59961bb9f4e77b01..680826fa386950a5da5bb30f942ed7f8f6a47138 100644
--- a/src/lib/builtins/is.rs
+++ b/src/lib/builtins/is.rs
@@ -4,14 +4,18 @@ use types;
 
 pub(crate) fn is(args: &[small::String], shell: &mut Shell) -> Result<(), String> {
     match args.len() {
-        4 => if args[1] != "not" {
-            return Err(format!("Expected 'not' instead found '{}'\n", args[1]).to_string());
-        } else if eval_arg(&*args[2], shell) == eval_arg(&*args[3], shell) {
-            return Err("".to_string());
-        },
-        3 => if eval_arg(&*args[1], shell) != eval_arg(&*args[2], shell) {
-            return Err("".to_string());
-        },
+        4 => {
+            if args[1] != "not" {
+                return Err(format!("Expected 'not' instead found '{}'\n", args[1]).to_string());
+            } else if eval_arg(&*args[2], shell) == eval_arg(&*args[3], shell) {
+                return Err("".to_string());
+            }
+        }
+        3 => {
+            if eval_arg(&*args[1], shell) != eval_arg(&*args[2], shell) {
+                return Err("".to_string());
+            }
+        }
         _ => return Err("is needs 3 or 4 arguments\n".to_string()),
     }
 
@@ -53,32 +57,14 @@ fn test_is() {
         is(&vec_string(&["is", " ", " ", " "]), &mut shell),
         Err("Expected 'not' instead found ' '\n".to_string())
     );
-    assert_eq!(
-        is(&vec_string(&["is", "not", " ", " "]), &mut shell),
-        Err("".to_string())
-    );
-    assert_eq!(
-        is(&vec_string(&["is", "not", "$x", "$x"]), &mut shell),
-        Err("".to_string())
-    );
-    assert_eq!(
-        is(&vec_string(&["is", "not", "2", "1"]), &mut shell),
-        Ok(())
-    );
-    assert_eq!(
-        is(&vec_string(&["is", "not", "$x", "$y"]), &mut shell),
-        Ok(())
-    );
+    assert_eq!(is(&vec_string(&["is", "not", " ", " "]), &mut shell), Err("".to_string()));
+    assert_eq!(is(&vec_string(&["is", "not", "$x", "$x"]), &mut shell), Err("".to_string()));
+    assert_eq!(is(&vec_string(&["is", "not", "2", "1"]), &mut shell), Ok(()));
+    assert_eq!(is(&vec_string(&["is", "not", "$x", "$y"]), &mut shell), Ok(()));
 
     // Three arguments
-    assert_eq!(
-        is(&vec_string(&["is", "1", "2"]), &mut shell),
-        Err("".to_string())
-    );
-    assert_eq!(
-        is(&vec_string(&["is", "$x", "$y"]), &mut shell),
-        Err("".to_string())
-    );
+    assert_eq!(is(&vec_string(&["is", "1", "2"]), &mut shell), Err("".to_string()));
+    assert_eq!(is(&vec_string(&["is", "$x", "$y"]), &mut shell), Err("".to_string()));
     assert_eq!(is(&vec_string(&["is", " ", " "]), &mut shell), Ok(()));
     assert_eq!(is(&vec_string(&["is", "$x", "$x"]), &mut shell), Ok(()));
 
diff --git a/src/lib/builtins/job_control.rs b/src/lib/builtins/job_control.rs
index 8825d74682d3613f0199296dba550115948db626..0fa7425cf6c4f5f5a38c90752366efa08f32f129 100644
--- a/src/lib/builtins/job_control.rs
+++ b/src/lib/builtins/job_control.rs
@@ -30,9 +30,8 @@ pub(crate) fn disown(shell: &mut Shell, args: &[small::String]) -> Result<(), St
             "-h" => flags |= NO_SIGHUP,
             "-r" => flags |= RUN_JOBS,
             _ => {
-                let jobspec = arg
-                    .parse::<u32>()
-                    .map_err(|_| format!("invalid jobspec: '{}'", arg))?;
+                let jobspec =
+                    arg.parse::<u32>().map_err(|_| format!("invalid jobspec: '{}'", arg))?;
                 collected_jobs.push(jobspec);
             }
         }
@@ -48,13 +47,9 @@ pub(crate) fn disown(shell: &mut Shell, args: &[small::String]) -> Result<(), St
     let mut process_table = shell.background.lock().unwrap();
     if collected_jobs.is_empty() && flags & ALL_JOBS != 0 {
         if flags & NO_SIGHUP != 0 {
-            process_table
-                .iter_mut()
-                .for_each(|process| process.ignore_sighup = true);
+            process_table.iter_mut().for_each(|process| process.ignore_sighup = true);
         } else {
-            process_table
-                .iter_mut()
-                .for_each(|process| process.state = ProcessState::Empty);
+            process_table.iter_mut().for_each(|process| process.state = ProcessState::Empty);
         }
     } else {
         collected_jobs.sort();
@@ -90,10 +85,7 @@ pub(crate) fn disown(shell: &mut Shell, args: &[small::String]) -> Result<(), St
 pub(crate) fn jobs(shell: &mut Shell) {
     for (id, process) in shell.background.lock().unwrap().iter().enumerate() {
         if process.state != ProcessState::Empty {
-            eprintln!(
-                "[{}] {} {}\t{}",
-                id, process.pid, process.state, process.name
-            );
+            eprintln!("[{}] {} {}\t{}", id, process.pid, process.state, process.name);
         }
     }
 }
@@ -152,13 +144,7 @@ pub(crate) fn fg(shell: &mut Shell, args: &[small::String]) -> i32 {
 /// Resumes a stopped background process, if it was stopped.
 pub(crate) fn bg(shell: &mut Shell, args: &[small::String]) -> i32 {
     fn bg_job(shell: &mut Shell, njob: u32) -> bool {
-        if let Some(job) = shell
-            .background
-            .lock()
-            .unwrap()
-            .iter_mut()
-            .nth(njob as usize)
-        {
+        if let Some(job) = shell.background.lock().unwrap().iter_mut().nth(njob as usize) {
             match job.state {
                 ProcessState::Running => {
                     eprintln!("ion: bg: job {} is already running", njob);
diff --git a/src/lib/builtins/mod.rs b/src/lib/builtins/mod.rs
index 2a1bb31fefe62523ac155d19c7cb5813566666eb..1989df67caebcfe5daca1c943bff7495cdcdd04a 100644
--- a/src/lib/builtins/mod.rs
+++ b/src/lib/builtins/mod.rs
@@ -503,11 +503,7 @@ fn builtin_exit(args: &[small::String], shell: &mut Shell) -> i32 {
         }
     }
     let previous_status = shell.previous_status;
-    shell.exit(
-        args.get(1)
-            .and_then(|status| status.parse::<i32>().ok())
-            .unwrap_or(previous_status),
-    )
+    shell.exit(args.get(1).and_then(|status| status.parse::<i32>().ok()).unwrap_or(previous_status))
 }
 
 fn builtin_exec(args: &[small::String], shell: &mut Shell) -> i32 {
@@ -590,17 +586,21 @@ fn builtin_isatty(args: &[small::String], _: &mut Shell) -> i32 {
         // sys::isatty expects a usize if compiled for redox but otherwise a i32.
         #[cfg(target_os = "redox")]
         match args[1].parse::<usize>() {
-            Ok(r) => if sys::isatty(r) {
-                return SUCCESS;
-            },
+            Ok(r) => {
+                if sys::isatty(r) {
+                    return SUCCESS;
+                }
+            }
             Err(_) => eprintln!("ion: isatty given bad number"),
         }
 
         #[cfg(not(target_os = "redox"))]
         match args[1].parse::<i32>() {
-            Ok(r) => if sys::isatty(r) {
-                return SUCCESS;
-            },
+            Ok(r) => {
+                if sys::isatty(r) {
+                    return SUCCESS;
+                }
+            }
             Err(_) => eprintln!("ion: isatty given bad number"),
         }
     } else {
diff --git a/src/lib/builtins/set.rs b/src/lib/builtins/set.rs
index 2de8876ff8ca666e7d21f1b33b28e1894b423979..6ffdb73545ebc747552571408dae15952cd75b84 100644
--- a/src/lib/builtins/set.rs
+++ b/src/lib/builtins/set.rs
@@ -31,12 +31,16 @@ pub(crate) fn set(args: &[small::String], shell: &mut Shell) -> i32 {
                 match flag {
                     b'e' => shell.flags |= ERR_EXIT,
                     b'o' => match args_iter.next().map(|s| s as &str) {
-                        Some("vi") => if let Some(context) = shell.context.as_mut() {
-                            context.key_bindings = KeyBindings::Vi;
-                        },
-                        Some("emacs") => if let Some(context) = shell.context.as_mut() {
-                            context.key_bindings = KeyBindings::Emacs;
-                        },
+                        Some("vi") => {
+                            if let Some(context) = shell.context.as_mut() {
+                                context.key_bindings = KeyBindings::Vi;
+                            }
+                        }
+                        Some("emacs") => {
+                            if let Some(context) = shell.context.as_mut() {
+                                context.key_bindings = KeyBindings::Emacs;
+                            }
+                        }
                         Some("huponexit") => shell.flags |= HUPONEXIT,
                         Some(_) => {
                             eprintln!("ion: set: invalid option");
@@ -85,9 +89,11 @@ pub(crate) fn set(args: &[small::String], shell: &mut Shell) -> i32 {
                 UnsetIfNone => {
                     shell.variables.set("args", arguments);
                 }
-                RetainIfNone => if arguments.len() != 1 {
-                    shell.variables.set("args", arguments);
-                },
+                RetainIfNone => {
+                    if arguments.len() != 1 {
+                        shell.variables.set("args", arguments);
+                    }
+                }
             }
         }
     }
diff --git a/src/lib/builtins/source.rs b/src/lib/builtins/source.rs
index cb2473c5a1030be61ae4378b49b09294cf9aefc2..650e8c18db0290d8934120b90a56b306b8ff0733 100644
--- a/src/lib/builtins/source.rs
+++ b/src/lib/builtins/source.rs
@@ -5,20 +5,21 @@ use std::{fs::File, io::Read};
 /// Evaluates the given file and returns 'SUCCESS' if it succeeds.
 pub(crate) fn source(shell: &mut Shell, arguments: &[small::String]) -> Result<(), String> {
     match arguments.get(1) {
-        Some(argument) => if let Ok(mut file) = File::open(argument.as_str()) {
-            let capacity = file.metadata().map(|x| x.len()).unwrap_or(1) as usize;
-            let mut command_list = String::with_capacity(capacity);
-            file.read_to_string(&mut command_list)
-                .map_err(|message| format!("ion: {}: failed to read {}\n", message, argument))
-                .map(|_| {
-                    for command in command_list.lines() {
-                        shell.on_command(command);
-                    }
-                    ()
-                })
-        } else {
-            Err(format!("ion: failed to open {}\n", argument))
-        },
+        Some(argument) => {
+            if let Ok(mut file) = File::open(argument.as_str()) {
+                let capacity = file.metadata().map(|x| x.len()).unwrap_or(1) as usize;
+                let mut command_list = String::with_capacity(capacity);
+                file.read_to_string(&mut command_list)
+                    .map_err(|message| format!("ion: {}: failed to read {}\n", message, argument))
+                    .map(|_| {
+                        for command in command_list.lines() {
+                            shell.on_command(command);
+                        }
+                    })
+            } else {
+                Err(format!("ion: failed to open {}\n", argument))
+            }
+        }
         None => {
             shell.evaluate_init_file();
             Ok(())
diff --git a/src/lib/builtins/status.rs b/src/lib/builtins/status.rs
index 3ea2fba15f02a1ce061212ce5c0f8074bcdf839f..ba4b683426ec01c2fc7eda22162488bd9e8c80aa 100644
--- a/src/lib/builtins/status.rs
+++ b/src/lib/builtins/status.rs
@@ -35,15 +35,17 @@ pub(crate) fn status(args: &[small::String], shell: &mut Shell) -> Result<(), St
                 "--is-login" => flags |= Flags::LOGIN_SHELL,
                 "--is-interactive" => flags |= Flags::INTERACTIVE,
                 "--current-filename" => flags |= Flags::FILENAME,
-                _ => if arg.starts_with('-') {
-                    match arg.chars().nth(1).unwrap() {
-                        'h' => flags |= Flags::HELP,
-                        'l' => flags |= Flags::LOGIN_SHELL,
-                        'i' => flags |= Flags::INTERACTIVE,
-                        'f' => flags |= Flags::FILENAME,
-                        _ => (),
+                _ => {
+                    if arg.starts_with('-') {
+                        match arg.chars().nth(1).unwrap() {
+                            'h' => flags |= Flags::HELP,
+                            'l' => flags |= Flags::LOGIN_SHELL,
+                            'i' => flags |= Flags::INTERACTIVE,
+                            'f' => flags |= Flags::FILENAME,
+                            _ => (),
+                        }
                     }
-                },
+                }
             }
         }
         let err = "".to_string();
diff --git a/src/lib/parser/assignments/actions.rs b/src/lib/parser/assignments/actions.rs
index aec3c5c5f30a720c2ad1d72dde0483f7ae0df048..5c386413c64c80fc97e1a88536da80236c259057 100644
--- a/src/lib/parser/assignments/actions.rs
+++ b/src/lib/parser/assignments/actions.rs
@@ -1,6 +1,7 @@
 use super::checker::*;
 use lexers::{
-    assignments::{Key, KeyIterator, Operator, Primitive, TypeError}, ArgumentSplitter,
+    assignments::{Key, KeyIterator, Operator, Primitive, TypeError},
+    ArgumentSplitter,
 };
 use std::fmt::{self, Display, Formatter};
 
@@ -36,11 +37,9 @@ impl<'a> Display for AssignmentError<'a> {
                 "repeated assignment to same key, and thus ignored. Repeated key: '{}'",
                 repkey
             ),
-            AssignmentError::NoKey(ref lone_val) => write!(
-                f,
-                "no key to assign value, thus ignored. Value: '{}'",
-                lone_val
-            ),
+            AssignmentError::NoKey(ref lone_val) => {
+                write!(f, "no key to assign value, thus ignored. Value: '{}'", lone_val)
+            }
         }
     }
 }
@@ -90,16 +89,20 @@ impl<'a> Iterator for AssignmentActions<'a> {
                 }
                 Err(why) => Some(Err(AssignmentError::TypeError(why))),
             },
-            (None, Some(lone_val)) => if let Some(&prevkey) = self.prevkeys.last() {
-                Some(Err(AssignmentError::ExtraValues(prevkey, self.prevval)))
-            } else {
-                Some(Err(AssignmentError::NoKey(lone_val)))
-            },
-            (Some(_), None) => if let Some(&prevkey) = self.prevkeys.last() {
-                Some(Err(AssignmentError::ExtraKeys(prevkey, self.prevval)))
-            } else {
-                unreachable!()
-            },
+            (None, Some(lone_val)) => {
+                if let Some(&prevkey) = self.prevkeys.last() {
+                    Some(Err(AssignmentError::ExtraValues(prevkey, self.prevval)))
+                } else {
+                    Some(Err(AssignmentError::NoKey(lone_val)))
+                }
+            }
+            (Some(_), None) => {
+                if let Some(&prevkey) = self.prevkeys.last() {
+                    Some(Err(AssignmentError::ExtraKeys(prevkey, self.prevval)))
+                } else {
+                    unreachable!()
+                }
+            }
             _ => None,
         }
     }
@@ -128,11 +131,13 @@ impl<'a> Action<'a> {
             | Primitive::IntegerArray
             | Primitive::StrArray
             | Primitive::HashMap(_)
-            | Primitive::BTreeMap(_) => if is_array(value) {
-                Ok(Action::UpdateArray(var, operator, value))
-            } else {
-                Err(AssignmentError::InvalidValue(var.kind, Primitive::Any))
-            },
+            | Primitive::BTreeMap(_) => {
+                if is_array(value) {
+                    Ok(Action::UpdateArray(var, operator, value))
+                } else {
+                    Err(AssignmentError::InvalidValue(var.kind, Primitive::Any))
+                }
+            }
             Primitive::Indexed(..) => Ok(Action::UpdateArray(var, operator, value)),
             Primitive::Any if is_array(value) => Ok(Action::UpdateArray(var, operator, value)),
             Primitive::Any => Ok(Action::UpdateString(var, operator, value)),
@@ -162,10 +167,7 @@ mod tests {
         assert_eq!(
             actions[0],
             Ok(Action::UpdateString(
-                Key {
-                    name: "abc",
-                    kind: Primitive::Any,
-                },
+                Key { name: "abc", kind: Primitive::Any },
                 Operator::Equal,
                 "123",
             ))
@@ -173,10 +175,7 @@ mod tests {
         assert_eq!(
             actions[1],
             Ok(Action::UpdateString(
-                Key {
-                    name: "def",
-                    kind: Primitive::Any,
-                },
+                Key { name: "def", kind: Primitive::Any },
                 Operator::Equal,
                 "456",
             ))
@@ -188,10 +187,7 @@ mod tests {
         assert_eq!(
             actions[0],
             Ok(Action::UpdateString(
-                Key {
-                    name: "ab",
-                    kind: Primitive::Integer,
-                },
+                Key { name: "ab", kind: Primitive::Integer },
                 Operator::Multiply,
                 "3",
             ))
@@ -203,10 +199,7 @@ mod tests {
         assert_eq!(
             actions[0],
             Ok(Action::UpdateString(
-                Key {
-                    name: "a",
-                    kind: Primitive::Any,
-                },
+                Key { name: "a", kind: Primitive::Any },
                 Operator::Equal,
                 "one",
             ))
@@ -214,10 +207,7 @@ mod tests {
         assert_eq!(
             actions[1],
             Ok(Action::UpdateArray(
-                Key {
-                    name: "b",
-                    kind: Primitive::AnyArray,
-                },
+                Key { name: "b", kind: Primitive::AnyArray },
                 Operator::Equal,
                 "[two three]",
             ))
@@ -225,10 +215,7 @@ mod tests {
         assert_eq!(
             actions[2],
             Ok(Action::UpdateArray(
-                Key {
-                    name: "c",
-                    kind: Primitive::IntegerArray,
-                },
+                Key { name: "c", kind: Primitive::IntegerArray },
                 Operator::Equal,
                 "[4 5 6]",
             ))
@@ -240,10 +227,7 @@ mod tests {
         assert_eq!(
             actions[0],
             Ok(Action::UpdateArray(
-                Key {
-                    name: "a",
-                    kind: Primitive::AnyArray,
-                },
+                Key { name: "a", kind: Primitive::AnyArray },
                 Operator::Equal,
                 "[one two]",
             ))
@@ -251,10 +235,7 @@ mod tests {
         assert_eq!(
             actions[1],
             Ok(Action::UpdateString(
-                Key {
-                    name: "b",
-                    kind: Primitive::Any,
-                },
+                Key { name: "b", kind: Primitive::Any },
                 Operator::Equal,
                 "three",
             ))
@@ -262,10 +243,7 @@ mod tests {
         assert_eq!(
             actions[2],
             Ok(Action::UpdateArray(
-                Key {
-                    name: "c",
-                    kind: Primitive::AnyArray,
-                },
+                Key { name: "c", kind: Primitive::AnyArray },
                 Operator::Equal,
                 "[four five]",
             ))
@@ -276,10 +254,7 @@ mod tests {
         assert_eq!(
             actions[0],
             Ok(Action::UpdateArray(
-                Key {
-                    name: "array",
-                    kind: Primitive::Any,
-                },
+                Key { name: "array", kind: Primitive::Any },
                 Operator::Concatenate,
                 "[one two three four five]",
             ))
@@ -290,10 +265,7 @@ mod tests {
         assert_eq!(
             actions[0],
             Ok(Action::UpdateArray(
-                Key {
-                    name: "array",
-                    kind: Primitive::Any,
-                },
+                Key { name: "array", kind: Primitive::Any },
                 Operator::ConcatenateHead,
                 "[1 2 3 4 5]",
             ))
@@ -304,10 +276,7 @@ mod tests {
         assert_eq!(
             actions[0],
             Ok(Action::UpdateArray(
-                Key {
-                    name: "array",
-                    kind: Primitive::Any,
-                },
+                Key { name: "array", kind: Primitive::Any },
                 Operator::Filter,
                 "[foo bar baz]",
             ))
diff --git a/src/lib/parser/assignments/checker.rs b/src/lib/parser/assignments/checker.rs
index 243a8ad26db87a2e5ea045a2ab232827f5e0b71a..7165bb184ac479671fcd7ead4023081f71a83dda 100644
--- a/src/lib/parser/assignments/checker.rs
+++ b/src/lib/parser/assignments/checker.rs
@@ -143,9 +143,7 @@ fn is_float_array(value: VariableType) -> Result<VariableType, ()> {
 }
 
 fn get_string<E: Expander>(shell: &E, value: &str) -> VariableType {
-    VariableType::Str(types::Str::from(
-        expand_string(value, shell, false).join(" "),
-    ))
+    VariableType::Str(types::Str::from(expand_string(value, shell, false).join(" ")))
 }
 
 fn get_array<E: Expander>(shell: &E, value: &str) -> VariableType {
@@ -306,13 +304,7 @@ mod test {
     #[test]
     fn is_integer_array_() {
         let expected = Ok(VariableType::Array(array!["1", "2", "3"]));
-        assert_eq!(
-            is_integer_array(VariableType::Array(array!["1", "2", "3"])),
-            expected
-        );
-        assert_eq!(
-            is_integer_array(VariableType::Array(array!["1", "2", "three"])),
-            Err(())
-        );
+        assert_eq!(is_integer_array(VariableType::Array(array!["1", "2", "3"])), expected);
+        assert_eq!(is_integer_array(VariableType::Array(array!["1", "2", "three"])), Err(()));
     }
 }
diff --git a/src/lib/parser/pipelines/collector.rs b/src/lib/parser/pipelines/collector.rs
index 04c4613f746b4f43a2b32a4eca3d43ed1e5fe6fb..a1c28c6fa2f60befa125b26ed898d71596c51542 100644
--- a/src/lib/parser/pipelines/collector.rs
+++ b/src/lib/parser/pipelines/collector.rs
@@ -5,16 +5,23 @@ use shell::{Job, JobKind};
 use types::*;
 
 trait AddItem {
-    fn add_item(&mut self, job_kind: JobKind, args: &mut Array, outputs: &mut Option<Vec<Redirection>>, inputs: &mut Option<Vec<Input>>);
+    fn add_item(
+        &mut self,
+        job_kind: JobKind,
+        args: &mut Array,
+        outputs: &mut Option<Vec<Redirection>>,
+        inputs: &mut Option<Vec<Input>>,
+    );
 }
 
 impl AddItem for Pipeline {
-    fn add_item(&mut self,
-                job_kind: JobKind,
-                args: &mut Array,
-                outputs: &mut Option<Vec<Redirection>>,
-                inputs: &mut Option<Vec<Input>>)
-    {
+    fn add_item(
+        &mut self,
+        job_kind: JobKind,
+        args: &mut Array,
+        outputs: &mut Option<Vec<Redirection>>,
+        inputs: &mut Option<Vec<Input>>,
+    ) {
         if !args.is_empty() {
             let job = Job::new(args.clone(), job_kind);
             args.clear();
@@ -39,7 +46,8 @@ impl<'a> Collector<'a> {
     /// Add a new argument that is re
     #[inline(always)]
     fn push_arg<I>(&self, args: &mut Array, bytes: &mut Peekable<I>) -> Result<(), &'static str>
-        where I: Iterator<Item=(usize, u8)>,
+    where
+        I: Iterator<Item = (usize, u8)>,
     {
         match self.arg(bytes) {
             Ok(Some(v)) => {
@@ -53,11 +61,14 @@ impl<'a> Collector<'a> {
 
     /// Attempt to add a redirection
     #[inline(always)]
-    fn push_redir_to_output<I>(&self,
-                               from: RedirectFrom,
-                               outputs: &mut Option<Vec<Redirection>>,
-                               bytes: &mut Peekable<I>) -> Result<(), &'static str>
-        where I: Iterator<Item=(usize, u8)>,
+    fn push_redir_to_output<I>(
+        &self,
+        from: RedirectFrom,
+        outputs: &mut Option<Vec<Redirection>>,
+        bytes: &mut Peekable<I>,
+    ) -> Result<(), &'static str>
+    where
+        I: Iterator<Item = (usize, u8)>,
     {
         if outputs.is_none() {
             *outputs = Some(Vec::new());
@@ -71,7 +82,10 @@ impl<'a> Collector<'a> {
         let arg = self.arg(bytes)?;
         match arg {
             Some(file) => {
-                outputs.as_mut().map(|o| o.push(Redirection { from: from, file: file.into(), append, }));
+                if let Some(o) = outputs.as_mut() {
+                    o.push(Redirection { from, file: file.into(), append });
+                }
+
                 Ok(())
             }
             None => Err("expected file argument after redirection for output"),
@@ -95,18 +109,37 @@ impl<'a> Collector<'a> {
                         Some(&(_, b'>')) => {
                             // And this byte
                             bytes.next();
-                            self.push_redir_to_output(RedirectFrom::Both, &mut outputs, &mut bytes)?;
+                            self.push_redir_to_output(
+                                RedirectFrom::Both,
+                                &mut outputs,
+                                &mut bytes,
+                            )?;
                         }
                         Some(&(_, b'|')) => {
                             bytes.next();
-                            pipeline.add_item(JobKind::Pipe(RedirectFrom::Both), &mut args, &mut outputs, &mut inputs);
+                            pipeline.add_item(
+                                JobKind::Pipe(RedirectFrom::Both),
+                                &mut args,
+                                &mut outputs,
+                                &mut inputs,
+                            );
                         }
                         Some(&(_, b'!')) => {
                             bytes.next();
-                            pipeline.add_item(JobKind::Disown, &mut args, &mut outputs, &mut inputs);
+                            pipeline.add_item(
+                                JobKind::Disown,
+                                &mut args,
+                                &mut outputs,
+                                &mut inputs,
+                            );
                         }
                         Some(_) | None => {
-                            pipeline.add_item(JobKind::Background, &mut args, &mut outputs, &mut inputs);
+                            pipeline.add_item(
+                                JobKind::Background,
+                                &mut args,
+                                &mut outputs,
+                                &mut inputs,
+                            );
                         }
                     }
                 }
@@ -117,19 +150,33 @@ impl<'a> Collector<'a> {
                         Some(b'>') => {
                             bytes.next();
                             bytes.next();
-                            self.push_redir_to_output(RedirectFrom::Stderr, &mut outputs, &mut bytes)?;
+                            self.push_redir_to_output(
+                                RedirectFrom::Stderr,
+                                &mut outputs,
+                                &mut bytes,
+                            )?;
                         }
                         Some(b'|') => {
                             bytes.next();
                             bytes.next();
-                            pipeline.add_item(JobKind::Pipe(RedirectFrom::Stderr), &mut args, &mut outputs, &mut inputs);
+                            pipeline.add_item(
+                                JobKind::Pipe(RedirectFrom::Stderr),
+                                &mut args,
+                                &mut outputs,
+                                &mut inputs,
+                            );
                         }
                         Some(_) | None => self.push_arg(&mut args, &mut bytes)?,
                     }
                 }
                 b'|' => {
                     bytes.next();
-                    pipeline.add_item(JobKind::Pipe(RedirectFrom::Stdout), &mut args, &mut outputs, &mut inputs);
+                    pipeline.add_item(
+                        JobKind::Pipe(RedirectFrom::Stdout),
+                        &mut args,
+                        &mut outputs,
+                        &mut inputs,
+                    );
                 }
                 b'>' => {
                     bytes.next();
@@ -264,13 +311,15 @@ impl<'a> Collector<'a> {
                     array_brace_counter = array_brace_counter.wrapping_mul(2);
                     bytes.next();
                 }
-                b'}' => if array_brace_counter % 2 == 0 {
-                    brace_level -= 1;
-                    array_brace_counter /= 2;
-                    bytes.next();
-                } else {
-                    break;
-                },
+                b'}' => {
+                    if array_brace_counter % 2 == 0 {
+                        brace_level -= 1;
+                        array_brace_counter /= 2;
+                        bytes.next();
+                    } else {
+                        break;
+                    }
+                }
                 // This is a tricky one: we only end the argment if `^` is followed by a
                 // redirection character
                 b'^' => {
@@ -359,7 +408,7 @@ impl<'a> Collector<'a> {
                 // We return an inclusive range to keep the quote type intact
                 b'"' => {
                     bytes.next();
-                    return Ok(&self.data[start..i + 1]);
+                    return Ok(&self.data[start..=i]);
                 }
                 _ => (),
             }
@@ -460,10 +509,7 @@ mod tests {
         if let Statement::Pipeline(pipeline) = parse("echo $(echo one $(echo two) three)") {
             let items = pipeline.items;
             assert_eq!("echo", items[0].job.args[0].as_str());
-            assert_eq!(
-                "$(echo one $(echo two) three)",
-                items[0].job.args[1].as_str()
-            );
+            assert_eq!("$(echo one $(echo two) three)", items[0].job.args[1].as_str());
         } else {
             assert!(false);
         }
@@ -474,10 +520,7 @@ mod tests {
         if let Statement::Pipeline(pipeline) = parse("echo @(echo one @(echo two) three)") {
             let items = pipeline.items;
             assert_eq!("echo", items[0].job.args[0].as_str());
-            assert_eq!(
-                "@(echo one @(echo two) three)",
-                items[0].job.args[1].as_str()
-            );
+            assert_eq!("@(echo one @(echo two) three)", items[0].job.args[1].as_str());
         } else {
             assert!(false);
         }
@@ -978,10 +1021,7 @@ mod tests {
             assert_eq!("awk", pipeline.clone().items[0].job.args[0].as_str());
             assert_eq!("-v", pipeline.clone().items[0].job.args[1].as_str());
             assert_eq!("x=$x", pipeline.clone().items[0].job.args[2].as_str());
-            assert_eq!(
-                "'{ if (1) print $1 }'",
-                pipeline.clone().items[0].job.args[3].as_str()
-            );
+            assert_eq!("'{ if (1) print $1 }'", pipeline.clone().items[0].job.args[3].as_str());
             assert_eq!("myfile", pipeline.clone().items[0].job.args[4].as_str());
         } else {
             assert!(false);
diff --git a/src/lib/parser/pipelines/mod.rs b/src/lib/parser/pipelines/mod.rs
index 639c3d60227c86f5623bdbfb94d4a19f488596d9..72f0aec0242c52be0adb6c5d93b99a004d729871 100644
--- a/src/lib/parser/pipelines/mod.rs
+++ b/src/lib/parser/pipelines/mod.rs
@@ -3,13 +3,9 @@ mod collector;
 pub(crate) use self::collector::*;
 
 use super::expand_string;
-use shell::{Job, JobKind, Shell, pipe_exec::stdin_of};
+use shell::{pipe_exec::stdin_of, Job, JobKind, Shell};
 use small;
-use std::{
-    os::unix::io::FromRawFd,
-    fmt,
-    fs::File,
-};
+use std::{fmt, fs::File, os::unix::io::FromRawFd};
 
 #[derive(Debug, PartialEq, Clone, Copy)]
 pub(crate) enum RedirectFrom {
@@ -91,18 +87,12 @@ impl PipeItem {
         }
 
         for output in &mut self.outputs {
-            output.file = expand_string(output.file.as_str(), shell, false)
-                .join(" ")
-                .into();
+            output.file = expand_string(output.file.as_str(), shell, false).join(" ").into();
         }
     }
 
     pub(crate) fn new(job: Job, outputs: Vec<Redirection>, inputs: Vec<Input>) -> Self {
-        PipeItem {
-            job,
-            outputs,
-            inputs,
-        }
+        PipeItem { job, outputs, inputs }
     }
 }
 
diff --git a/src/lib/parser/quotes.rs b/src/lib/parser/quotes.rs
index 1f2690f59ae70447f2b17fec3a903b753e08e590..8fd68b79b4e1cdf448bd6b6ddf58f39b02a0bcab 100644
--- a/src/lib/parser/quotes.rs
+++ b/src/lib/parser/quotes.rs
@@ -1,14 +1,11 @@
-use std::str;
+use itertools::Itertools;
+use std::{iter::Peekable, mem, str};
 
 bitflags! {
     pub struct Flags : u8 {
         const SQUOTE = 1;
         const DQUOTE = 2;
         const TRIM   = 4;
-        const ARRAY  = 8;
-        const COMM   = 16;
-        const EOF    = 32;
-        const ERROR  = 64;
     }
 }
 
@@ -36,140 +33,174 @@ impl From<String> for Terminator {
     fn from(string: String) -> Terminator { Terminator::new(string) }
 }
 
+#[derive(Debug)]
+enum NotTerminatedErr {
+    StartEof,
+    Eof,
+    Comment,
+    UnclosedArray,
+    UnclosedString,
+    EscapedNewline,
+    AndOrClause,
+}
+
+#[derive(Clone, Debug)]
+pub struct RearPeekable<I: Iterator> {
+    iter: Peekable<I>,
+    now:  Option<I::Item>,
+    last: Option<I::Item>,
+}
+
+impl<I> Iterator for RearPeekable<I>
+where
+    I: Iterator,
+    I::Item: Copy,
+{
+    type Item = I::Item;
+
+    #[inline]
+    fn next(&mut self) -> Option<I::Item> {
+        let next = self.iter.next();
+        if next.is_some() {
+            self.last = mem::replace(&mut self.now, next);
+        }
+        next
+    }
+}
+
+impl<I: Iterator> RearPeekable<I> {
+    #[inline]
+    pub fn peek(&mut self) -> Option<&I::Item> { self.iter.peek() }
+
+    #[inline]
+    pub fn prev(&self) -> Option<&I::Item> { self.last.as_ref() }
+
+    #[inline]
+    pub fn now(&self) -> Option<&I::Item> { self.now.as_ref() }
+}
+
 impl Terminator {
     /// Consumes the `Terminator`, and returns the underlying `String`.
     pub fn consume(self) -> String { self.buffer }
 
-    pub fn is_terminated(&mut self) -> bool {
-        let mut eof_line = None;
-        let eof = self.eof.clone();
-        let status = if let Some(ref eof) = eof {
-            let line = &self.eof_buffer;
-            eof_line = Some([&line, "\n"].concat());
-            line.trim() == eof
-        } else {
-            {
-                let mut instance = Flags::empty();
-                {
-                    let mut bytes = self.buffer.bytes().skip(self.read);
-                    while let Some(character) = bytes.next() {
-                        self.read += 1;
-                        match character {
-                            b'\\' => {
-                                let _ = bytes.next();
-                            }
-                            b'\'' if !self.flags.intersects(Flags::DQUOTE) => {
-                                self.flags ^= Flags::SQUOTE
-                            }
-                            b'"' if !self.flags.intersects(Flags::SQUOTE) => {
-                                self.flags ^= Flags::DQUOTE
-                            }
-                            b'<' if !self.flags.intersects(Flags::SQUOTE | Flags::DQUOTE) => {
-                                let as_bytes = self.buffer.as_bytes();
-                                if Some(&b'<') == as_bytes.get(self.read) {
-                                    self.read += 1;
-                                    if Some(&b'<') != as_bytes.get(self.read) {
-                                        let eof_phrase = unsafe {
-                                            str::from_utf8_unchecked(&as_bytes[self.read..])
-                                        };
-                                        self.eof = Some(eof_phrase.trim().to_owned());
-                                        instance |= Flags::EOF;
-                                        break;
-                                    }
-                                }
-                            }
-                            b'[' if !self.flags.intersects(Flags::DQUOTE | Flags::SQUOTE) => {
-                                self.flags |= Flags::ARRAY;
-                                self.array += 1;
-                            }
-                            b']' if !self.flags.intersects(Flags::DQUOTE | Flags::SQUOTE) => {
-                                if self.array > 0 {
-                                    self.array -= 1;
-                                } else if self.array == 0 && self.flags.contains(Flags::ARRAY) {
-                                    instance |= Flags::ERROR;
-                                    break;
-                                }
-
-                                if self.array == 0 {
-                                    self.flags -= Flags::ARRAY
-                                }
-                            }
-                            b'#' if !self.flags.intersects(Flags::DQUOTE | Flags::SQUOTE) => {
-                                if self.read > 1 {
-                                    let character =
-                                        self.buffer.as_bytes().get(self.read - 2).unwrap();
-                                    if [b' ', b'\n'].contains(character) {
-                                        instance |= Flags::COMM;
-                                        break;
-                                    }
-                                } else {
-                                    instance |= Flags::COMM;
-                                    break;
-                                }
-                            }
-                            _ => (),
-                        }
+    fn pair_components(&mut self) -> Result<(), NotTerminatedErr> {
+        if self.eof.as_ref() == Some(&self.eof_buffer) {
+            return Err(NotTerminatedErr::StartEof);
+        } else if self.eof.is_some() {
+            return Err(NotTerminatedErr::Eof);
+        }
+
+        let bytes = self
+            .buffer
+            .bytes()
+            .enumerate()
+            .skip(self.read)
+            .coalesce(
+                |prev, next| {
+                    if prev.1 == b'\\' {
+                        Ok((next.0, 0))
+                    } else {
+                        Err((prev, next))
+                    }
+                },
+            )
+            .filter(|&(_, c)| c != 0)
+            .peekable();
+
+        let mut bytes = RearPeekable { iter: bytes, now: None, last: None };
+
+        while let Some((i, character)) = bytes.next() {
+            self.read = i + 1;
+
+            match character {
+                b'\'' if !self.flags.intersects(Flags::DQUOTE) => {
+                    if bytes.find(|&(_, c)| c == b'\'').is_none() {
+                        self.flags ^= Flags::SQUOTE;
                     }
                 }
-                if instance.contains(Flags::ERROR) {
-                    self.buffer.clear();
-                    self.buffer.push('\n');
-                    return true;
-                } else if instance.contains(Flags::EOF) {
-                    self.buffer.push('\n');
-                    return false;
-                } else if instance.contains(Flags::COMM) {
-                    self.buffer.truncate(self.read - 1);
-                    return !self
-                        .flags
-                        .intersects(Flags::SQUOTE | Flags::DQUOTE | Flags::ARRAY);
+                b'"' if !self.flags.intersects(Flags::SQUOTE) => {
+                    if bytes.find(|&(_, c)| c == b'"').is_none() {
+                        self.flags ^= Flags::DQUOTE;
+                    }
                 }
-            }
-
-            if self
-                .flags
-                .intersects(Flags::SQUOTE | Flags::DQUOTE | Flags::ARRAY)
-            {
-                if let Some(b'\\') = self.buffer.bytes().last() {
-                    let _ = self.buffer.pop();
-                    self.read -= 1;
-                    self.flags |= Flags::TRIM;
-                } else {
-                    self.read += 1;
-                    self.buffer.push(if self.flags.contains(Flags::ARRAY) {
-                        ' '
+                b'<' if bytes.prev() == Some(&(i - 1, b'<')) => {
+                    if bytes.peek() == Some(&(i + 1, b'<')) {
+                        bytes.next();
                     } else {
-                        '\n'
-                    });
+                        let bytes = &self.buffer.as_bytes()[self.read..];
+                        let eof_phrase = unsafe { str::from_utf8_unchecked(bytes) };
+                        self.eof = Some(eof_phrase.trim().to_owned());
+                        return Err(NotTerminatedErr::Eof);
+                    }
                 }
-                false
-            } else if let Some(b'\\') = self.buffer.bytes().last() {
-                let _ = self.buffer.pop();
-                self.read -= 1;
-                self.flags |= Flags::TRIM;
-                false
-            } else {
-                // If the last two bytes are either '&&' or '||', we aren't terminated yet.
-                let bytes = self.buffer.as_bytes();
-                if bytes.len() >= 2 {
-                    let bytes = &bytes[bytes.len() - 2..];
-                    bytes != [b'&', b'&'] && bytes != [b'|', b'|']
-                } else {
-                    true
+                b'[' => {
+                    self.array += 1;
                 }
+                b']' => {
+                    if self.array > 0 {
+                        self.array -= 1;
+                    }
+                }
+                b'#' if bytes
+                    .prev()
+                    .filter(|&(j, c)| !(*j == i - 1 && [b' ', b'\n'].contains(c)))
+                    .is_none() =>
+                {
+                    return Err(NotTerminatedErr::Comment);
+                }
+                _ => (),
             }
-        };
+        }
 
-        if let Some(line) = eof_line {
-            self.buffer.push_str(&line);
+        if let Some((_, b'\\')) = bytes.now() {
+            Err(NotTerminatedErr::EscapedNewline)
+        } else if self.array > 0 {
+            Err(NotTerminatedErr::UnclosedArray)
+        } else if self.flags.intersects(Flags::SQUOTE | Flags::DQUOTE) {
+            Err(NotTerminatedErr::UnclosedString)
+        } else if bytes
+            .now()
+            .filter(|&&(_, now)| now == b'&' || now == b'|')
+            .and_then(|&(_, now)| bytes.prev().filter(|&&(_, prev)| prev == now))
+            .is_some()
+        {
+            Err(NotTerminatedErr::AndOrClause)
+        } else {
+            Ok(())
         }
-        if self.eof.is_some() {
-            self.eof_buffer.clear();
-            if status {
+    }
+
+    pub fn is_terminated(&mut self) -> bool {
+        match self.pair_components() {
+            Err(NotTerminatedErr::StartEof) => {
                 self.eof = None;
+                self.buffer.push('\n');
+                true
+            }
+            Err(NotTerminatedErr::Eof) => false,
+            Err(NotTerminatedErr::Comment) => {
+                self.buffer.truncate(self.read - 1);
+                self.array == 0 && !self.flags.intersects(Flags::SQUOTE | Flags::DQUOTE)
             }
+            Err(NotTerminatedErr::EscapedNewline) => {
+                self.buffer.pop();
+                self.read -= 1;
+                self.flags |= Flags::TRIM;
+                false
+            }
+            Err(NotTerminatedErr::UnclosedString) => {
+                self.read += 1;
+                self.buffer.push('\n');
+                false
+            }
+            Err(NotTerminatedErr::UnclosedArray) => {
+                self.read += 1;
+                self.buffer.push(' ');
+                false
+            }
+            Err(NotTerminatedErr::AndOrClause) => false,
+            Ok(()) => true,
         }
-        status
     }
 
     /// Appends a string to the internal buffer.
@@ -181,7 +212,10 @@ impl Terminator {
                 input
             });
         } else {
-            self.eof_buffer.push_str(input);
+            self.eof_buffer.clear();
+            self.eof_buffer.push_str(input.trim());
+            self.buffer.push('\n');
+            self.buffer.push_str(input);
         }
     }
 
diff --git a/src/lib/parser/shell_expand/mod.rs b/src/lib/parser/shell_expand/mod.rs
index 4f718136902d9f18f38861b7deaefe2a8ecd1120..1ed5af95f304afd6c133c43b5afe998e49decae1 100644
--- a/src/lib/parser/shell_expand/mod.rs
+++ b/src/lib/parser/shell_expand/mod.rs
@@ -55,11 +55,8 @@ fn expand_process<E: Expander>(
         if output.is_empty() {
             return;
         } else if quoted {
-            let output: &str = if let Some(pos) = output.rfind(|x| x != '\n') {
-                &output[..=pos]
-            } else {
-                &output
-            };
+            let output: &str =
+                if let Some(pos) = output.rfind(|x| x != '\n') { &output[..=pos] } else { &output };
             slice(current, output, selection)
         } else {
             // If we ever do something with UTF-8, this won't work
@@ -103,14 +100,15 @@ fn expand_brace<E: Expander>(
     reverse_quoting: bool,
 ) {
     let mut temp = Vec::new();
-    for word in nodes
-        .into_iter()
-        .flat_map(|node| expand_string_no_glob(node, expand_func, reverse_quoting))
+    for word in
+        nodes.iter().flat_map(|node| expand_string_no_glob(node, expand_func, reverse_quoting))
     {
         match parse_range(&word) {
-            Some(elements) => for word in elements {
-                temp.push(word)
-            },
+            Some(elements) => {
+                for word in elements {
+                    temp.push(word)
+                }
+            }
             None => temp.push(word),
         }
     }
@@ -133,22 +131,15 @@ fn array_expand<E: Expander>(
 ) -> types::Array {
     match selection {
         Select::None => types::Array::new(),
-        Select::All => elements
-            .iter()
-            .flat_map(|e| expand_string(e, expand_func, false))
-            .collect(),
-        Select::Index(index) => array_nth(elements, expand_func, index)
-            .into_iter()
-            .collect(),
+        Select::All => elements.iter().flat_map(|e| expand_string(e, expand_func, false)).collect(),
+        Select::Index(index) => array_nth(elements, expand_func, index).into_iter().collect(),
         Select::Range(range) => array_range(elements, expand_func, range),
         Select::Key(_) => types::Array::new(),
     }
 }
 
 fn array_nth<E: Expander>(elements: &[&str], expand_func: &E, index: Index) -> Option<types::Str> {
-    let mut expanded = elements
-        .iter()
-        .flat_map(|e| expand_string(e, expand_func, false));
+    let mut expanded = elements.iter().flat_map(|e| expand_string(e, expand_func, false));
     match index {
         Index::Forward(n) => expanded.nth(n),
         Index::Backward(n) => expanded.rev().nth(n),
@@ -172,26 +163,23 @@ fn slice<S: AsRef<str>>(output: &mut small::String, expanded: S, selection: Sele
     match selection {
         Select::None => (),
         Select::All => output.push_str(expanded.as_ref()),
-        Select::Index(Index::Forward(id)) => if let Some(character) =
-            UnicodeSegmentation::graphemes(expanded.as_ref(), true).nth(id)
-        {
-            output.push_str(character);
-        },
-        Select::Index(Index::Backward(id)) => if let Some(character) =
-            UnicodeSegmentation::graphemes(expanded.as_ref(), true)
-                .rev()
-                .nth(id)
-        {
-            output.push_str(character);
-        },
+        Select::Index(Index::Forward(id)) => {
+            if let Some(character) = UnicodeSegmentation::graphemes(expanded.as_ref(), true).nth(id)
+            {
+                output.push_str(character);
+            }
+        }
+        Select::Index(Index::Backward(id)) => {
+            if let Some(character) =
+                UnicodeSegmentation::graphemes(expanded.as_ref(), true).rev().nth(id)
+            {
+                output.push_str(character);
+            }
+        }
         Select::Range(range) => {
             let graphemes = UnicodeSegmentation::graphemes(expanded.as_ref(), true);
             if let Some((start, length)) = range.bounds(graphemes.clone().count()) {
-                let substring = graphemes
-                    .skip(start)
-                    .take(length)
-                    .collect::<Vec<&str>>()
-                    .join("");
+                let substring = graphemes.skip(start).take(length).collect::<Vec<&str>>().join("");
                 output.push_str(&substring);
             }
         }
@@ -330,11 +318,8 @@ fn expand_braces<E: Expander>(
                     expand_process(&mut temp, command, Select::All, expand_func, false);
                     let len = temp.split_whitespace().count();
                     if let Some((start, length)) = range.bounds(len) {
-                        let res = temp
-                            .split_whitespace()
-                            .skip(start)
-                            .take(length)
-                            .collect::<Vec<&str>>();
+                        let res =
+                            temp.split_whitespace().skip(start).take(length).collect::<Vec<&str>>();
                         output.push_str(&res.join(" "));
                     }
                 }
@@ -369,14 +354,7 @@ fn expand_braces<E: Expander>(
                 slice(&mut output, expanded, index.clone());
             }
             WordToken::Normal(ref text, _, tilde) => {
-                expand(
-                    &mut output,
-                    &mut expanded_words,
-                    expand_func,
-                    text.as_ref(),
-                    false,
-                    tilde,
-                );
+                expand(&mut output, &mut expanded_words, expand_func, text.as_ref(), false, tilde);
             }
             WordToken::Arithmetic(s) => expand_arithmetic(&mut output, s, expand_func),
         }
@@ -397,35 +375,32 @@ fn expand_braces<E: Expander>(
         }
     }
 
-    expanded_words
-        .into_iter()
-        .fold(types::Array::new(), |mut array, word| {
-            if word.find('*').is_some() {
-                if let Ok(mut paths) = glob(&word) {
-                    match paths.next() {
-                        Some(path) => if let Ok(path_buf) = path {
-                            array.push((*path_buf.to_string_lossy()).into());
-                        } else {
-                            array.push("".into());
-                        },
-                        None => {}
+    expanded_words.into_iter().fold(types::Array::new(), |mut array, word| {
+        if word.find('*').is_some() {
+            if let Ok(mut paths) = glob(&word) {
+                if let Some(path) = paths.next() {
+                    if let Ok(path_buf) = path {
+                        array.push((*path_buf.to_string_lossy()).into());
+                    } else {
+                        array.push("".into());
                     }
-                    for path in paths {
-                        if let Ok(path_buf) = path {
-                            array.push((*path_buf.to_string_lossy()).into());
-                        } else {
-                            array.push("".into());
-                        }
+                }
+                for path in paths {
+                    if let Ok(path_buf) = path {
+                        array.push((*path_buf.to_string_lossy()).into());
+                    } else {
+                        array.push("".into());
                     }
-                } else {
-                    array.push(word);
                 }
-                array
             } else {
                 array.push(word);
-                array
             }
-        })
+            array
+        } else {
+            array.push(word);
+            array
+        }
+    })
 }
 
 fn expand_single_array_token<E: Expander>(
@@ -450,35 +425,15 @@ fn expand_single_array_token<E: Expander>(
             Select::None => Some(types::Array::new()),
             Select::All => {
                 expand_process(&mut output, command, Select::All, expand_func, false);
-                Some(
-                    output
-                        .split_whitespace()
-                        .map(From::from)
-                        .collect::<types::Array>(),
-                )
+                Some(output.split_whitespace().map(From::from).collect::<types::Array>())
             }
             Select::Index(Index::Forward(id)) => {
                 expand_process(&mut output, command, Select::All, expand_func, false);
-                Some(
-                    output
-                        .split_whitespace()
-                        .nth(id)
-                        .map(Into::into)
-                        .into_iter()
-                        .collect(),
-                )
+                Some(output.split_whitespace().nth(id).map(Into::into).into_iter().collect())
             }
             Select::Index(Index::Backward(id)) => {
                 expand_process(&mut output, command, Select::All, expand_func, false);
-                Some(
-                    output
-                        .split_whitespace()
-                        .rev()
-                        .nth(id)
-                        .map(Into::into)
-                        .into_iter()
-                        .collect(),
-                )
+                Some(output.split_whitespace().rev().nth(id).map(Into::into).into_iter().collect())
             }
             Select::Range(range) => {
                 expand_process(&mut output, command, Select::All, expand_func, false);
@@ -513,14 +468,7 @@ fn expand_single_string_token<E: Expander>(
     match *token {
         WordToken::StringMethod(ref method) => method.handle(&mut output, expand_func),
         WordToken::Normal(ref text, do_glob, tilde) => {
-            expand(
-                &mut output,
-                &mut expanded_words,
-                expand_func,
-                text.as_ref(),
-                do_glob,
-                tilde,
-            );
+            expand(&mut output, &mut expanded_words, expand_func, text.as_ref(), do_glob, tilde);
         }
         WordToken::Whitespace(text) => output.push_str(text),
         WordToken::Process(command, quoted, ref index) => {
@@ -716,7 +664,7 @@ pub(crate) fn expand_tokens<E: Expander>(
         }
         expanded_words
     } else {
-        array![]
+        Array::new()
     }
 }
 
@@ -822,10 +770,7 @@ mod test {
                         prospective projections";
         let expanded = expand_string(line, &VariableExpander, false);
         assert_eq!(
-            expected
-                .split_whitespace()
-                .map(|x| x.into())
-                .collect::<types::Array>(),
+            expected.split_whitespace().map(|x| x.into()).collect::<types::Array>(),
             expanded
         );
     }
@@ -836,10 +781,7 @@ mod test {
         let expected = "Itemized Itemize Italicized Italicize Iterated Iterate";
         let expanded = expand_string(line, &VariableExpander, false);
         assert_eq!(
-            expected
-                .split_whitespace()
-                .map(|x| x.into())
-                .collect::<types::Array>(),
+            expected.split_whitespace().map(|x| x.into()).collect::<types::Array>(),
             expanded
         );
     }
@@ -926,10 +868,8 @@ mod test {
 
     #[test]
     fn inline_expression() {
-        let cases = vec![
-            (array!["5"], "$len([0 1 2 3 4])"),
-            (array!["FxOxO"], "$join(@chars('FOO') 'x')"),
-        ];
+        let cases =
+            vec![(array!["5"], "$len([0 1 2 3 4])"), (array!["FxOxO"], "$join(@chars('FOO') 'x')")];
         for (expected, input) in cases {
             assert_eq!(expected, expand_string(input, &VariableExpander, false));
         }
diff --git a/src/lib/parser/shell_expand/words/methods/arrays.rs b/src/lib/parser/shell_expand/words/methods/arrays.rs
index e2602879d5b096decf18741df21dc184c72df366..e86bc57787b099e7e7b127f91dd6e45c9405e9f1 100644
--- a/src/lib/parser/shell_expand/words/methods/arrays.rs
+++ b/src/lib/parser/shell_expand/words/methods/arrays.rs
@@ -51,22 +51,23 @@ impl<'a> ArrayMethod<'a> {
     }
 
     fn map_keys<'b, E: Expander>(&self, expand_func: &'b E) -> Result<Array, &'static str> {
-        expand_func.map_keys(self.variable, self.selection.clone())
+        expand_func
+            .map_keys(self.variable, self.selection.clone())
             .ok_or("no map found")
             .map(|x| x.cloned().collect())
     }
 
     fn map_values<'b, E: Expander>(&self, expand_func: &'b E) -> Result<Array, &'static str> {
-        expand_func.map_values(self.variable, self.selection.clone())
+        expand_func
+            .map_values(self.variable, self.selection.clone())
             .ok_or("no map found")
             .map(|x| x.collect())
     }
 
     fn graphemes<E: Expander>(&self, expand_func: &E) -> Result<Array, &'static str> {
         let variable = self.resolve_var(expand_func);
-        let graphemes: Vec<types::Str> = UnicodeSegmentation::graphemes(variable.as_str(), true)
-            .map(From::from)
-            .collect();
+        let graphemes: Vec<types::Str> =
+            UnicodeSegmentation::graphemes(variable.as_str(), true).map(From::from).collect();
         let len = graphemes.len();
         Ok(graphemes.into_iter().select(self.selection.clone(), len))
     }
@@ -74,20 +75,20 @@ impl<'a> ArrayMethod<'a> {
     fn split_at<E: Expander>(&self, expand_func: &E) -> Result<Array, &'static str> {
         let variable = self.resolve_var(expand_func);
         match self.pattern {
-            Pattern::StringPattern(string) => if let Ok(value) =
-                expand_string(string, expand_func, false)
-                    .join(" ")
-                    .parse::<usize>()
-            {
-                if value < variable.len() {
-                    let (l, r) = variable.split_at(value);
-                    Ok(array![types::Str::from(l), types::Str::from(r)])
+            Pattern::StringPattern(string) => {
+                if let Ok(value) =
+                    expand_string(string, expand_func, false).join(" ").parse::<usize>()
+                {
+                    if value < variable.len() {
+                        let (l, r) = variable.split_at(value);
+                        Ok(array![types::Str::from(l), types::Str::from(r)])
+                    } else {
+                        Err("value is out of bounds")
+                    }
                 } else {
-                    Err("value is out of bounds")
+                    Err("requires a valid number as an argument")
                 }
-            } else {
-                Err("requires a valid number as an argument")
-            },
+            }
             Pattern::Whitespace => Err("requires an argument"),
         }
     }
@@ -141,10 +142,7 @@ impl<'a> ArrayMethod<'a> {
                 }
             }
             (&Pattern::Whitespace, Select::Range(range)) => {
-                let len = variable
-                    .split(char::is_whitespace)
-                    .filter(|x| !x.is_empty())
-                    .count();
+                let len = variable.split(char::is_whitespace).filter(|x| !x.is_empty()).count();
                 if let Some((start, length)) = range.bounds(len) {
                     variable
                         .split(char::is_whitespace)
@@ -169,7 +167,7 @@ impl<'a> ArrayMethod<'a> {
         } else if is_expression(self.variable) {
             expand_string(self.variable, expand_func, false)
         } else {
-            array![]
+            Array::new()
         }
     }
 
@@ -200,7 +198,7 @@ impl<'a> ArrayMethod<'a> {
 
         res.unwrap_or_else(|m| {
             eprintln!("ion: {}: {}", self.method, m);
-            array![]
+            Array::new()
         })
     }
 
@@ -413,10 +411,7 @@ mod test {
             pattern:   Pattern::StringPattern("3"),
             selection: Select::All,
         };
-        assert_eq!(
-            method.handle_as_array(&VariableExpander),
-            array!["FOO", "BAR"]
-        );
+        assert_eq!(method.handle_as_array(&VariableExpander), array!["FOO", "BAR"]);
     }
 
     #[test]
@@ -427,10 +422,7 @@ mod test {
             pattern:   Pattern::StringPattern("3"),
             selection: Select::All,
         };
-        assert_eq!(
-            method.handle_as_array(&VariableExpander),
-            array!["F", "O", "O", "B", "A", "R"]
-        );
+        assert_eq!(method.handle_as_array(&VariableExpander), array!["F", "O", "O", "B", "A", "R"]);
     }
 
     #[test]
@@ -455,10 +447,7 @@ mod test {
             pattern:   Pattern::StringPattern("3"),
             selection: Select::All,
         };
-        assert_eq!(
-            method.handle_as_array(&VariableExpander),
-            array!["F", "O", "O", "B", "A", "R"]
-        );
+        assert_eq!(method.handle_as_array(&VariableExpander), array!["F", "O", "O", "B", "A", "R"]);
     }
 
     #[test]
@@ -469,10 +458,7 @@ mod test {
             pattern:   Pattern::StringPattern("3"),
             selection: Select::All,
         };
-        assert_eq!(
-            method.handle_as_array(&VariableExpander),
-            array!["FOO", "BAR"]
-        );
+        assert_eq!(method.handle_as_array(&VariableExpander), array!["FOO", "BAR"]);
     }
 
     #[test]
@@ -483,9 +469,6 @@ mod test {
             pattern:   Pattern::StringPattern("3"),
             selection: Select::All,
         };
-        assert_eq!(
-            method.handle_as_array(&VariableExpander),
-            array!["c", "b", "a"]
-        );
+        assert_eq!(method.handle_as_array(&VariableExpander), array!["c", "b", "a"]);
     }
 }
diff --git a/src/lib/parser/shell_expand/words/methods/mod.rs b/src/lib/parser/shell_expand/words/methods/mod.rs
index 65db38163c55f7b67b609f2e364286d307f6e91d..fb36e8cf39ebf395939e1a8416346484da404ad4 100644
--- a/src/lib/parser/shell_expand/words/methods/mod.rs
+++ b/src/lib/parser/shell_expand/words/methods/mod.rs
@@ -28,8 +28,7 @@ impl<'a, 'b, E: 'b + Expander> MethodArgs<'a, 'b, E> {
     }
 
     pub(crate) fn join(self, pattern: &str) -> small::String {
-        unescape(&expand_string(self.args, self.expand, false).join(pattern))
-            .unwrap_or_default()
+        unescape(&expand_string(self.args, self.expand, false).join(pattern)).unwrap_or_default()
     }
 
     pub(crate) fn new(args: &'a str, expand: &'b E) -> MethodArgs<'a, 'b, E> {
diff --git a/src/lib/parser/shell_expand/words/methods/strings.rs b/src/lib/parser/shell_expand/words/methods/strings.rs
index a8b1347f0549ddfe0cf8c8521ecef155cd6b1632..48b30fe393e8782528776d708d696ee5e11c87bf 100644
--- a/src/lib/parser/shell_expand/words/methods/strings.rs
+++ b/src/lib/parser/shell_expand/words/methods/strings.rs
@@ -14,7 +14,7 @@ use unicode_segmentation::UnicodeSegmentation;
 pub(crate) fn unescape(input: &str) -> Result<small::String, &'static str> {
     let mut check = false;
     // small::String cannot be created with a capacity of 0 without causing a panic
-    let len = if ! input.is_empty() { input.len() } else { 1 };
+    let len = if !input.is_empty() { input.len() } else { 1 };
     let mut out = small::String::with_capacity(len);
     let add_char = |out: &mut small::String, check: &mut bool, c| {
         out.push(c);
@@ -64,7 +64,8 @@ fn escape(input: &str) -> Result<String, &'static str> {
             12 => output.push_str("\\f"),
             13 => output.push_str("\\r"),
             27 => output.push_str("\\e"),
-            n if n != 59 && n != 95
+            n if n != 59
+                && n != 95
                 && ((n >= 33 && n < 48)
                     || (n >= 58 && n < 65)
                     || (n >= 91 && n < 97)
@@ -105,9 +106,7 @@ impl<'a> StringMethod<'a> {
                 let is_true = if let Some(value) = expand.string($variable, false) {
                     value.$method(pattern.as_str())
                 } else if is_expression($variable) {
-                    expand_string($variable, expand, false)
-                        .join(" ")
-                        .$method(pattern.as_str())
+                    expand_string($variable, expand, false).join(" ").$method(pattern.as_str())
                 } else {
                     false
                 };
@@ -170,15 +169,15 @@ impl<'a> StringMethod<'a> {
             "trim" => {
                 let word = get_var!();
                 output.push_str(word.trim());
-            },
+            }
             "trim_right" => {
                 let word = get_var!();
                 output.push_str(word.trim_right());
-            },
+            }
             "trim_left" => {
                 let word = get_var!();
                 output.push_str(word.trim_left());
-            },
+            }
             "repeat" => match pattern.join(" ").parse::<usize>() {
                 Ok(repeat) => output.push_str(&get_var!().repeat(repeat)),
                 Err(_) => {
@@ -198,13 +197,14 @@ impl<'a> StringMethod<'a> {
             "replacen" => {
                 let mut args = pattern.array();
                 match (args.next(), args.next(), args.next()) {
-                    (Some(replace), Some(with), Some(nth)) => if let Ok(nth) = nth.parse::<usize>()
-                    {
-                        let res = &get_var!().replacen(replace.as_str(), &with, nth);
-                        output.push_str(res);
-                    } else {
-                        eprintln!("ion: replacen: third argument isn't a valid integer");
-                    },
+                    (Some(replace), Some(with), Some(nth)) => {
+                        if let Ok(nth) = nth.parse::<usize>() {
+                            let res = &get_var!().replacen(replace.as_str(), &with, nth);
+                            output.push_str(res);
+                        } else {
+                            eprintln!("ion: replacen: third argument isn't a valid integer");
+                        }
+                    }
                     _ => eprintln!("ion: replacen: three arguments required"),
                 }
             }
@@ -237,31 +237,37 @@ impl<'a> StringMethod<'a> {
                     );
                 }
             }
-            "len" => if variable.starts_with('@') || is_array(variable) {
-                let expanded = expand_string(variable, expand, false);
-                output.push_str(&expanded.len().to_string());
-            } else if let Some(value) = expand.string(variable, false) {
-                let count = UnicodeSegmentation::graphemes(value.as_str(), true).count();
-                output.push_str(&count.to_string());
-            } else if is_expression(variable) {
-                let word = expand_string(variable, expand, false).join(" ");
-                let count = UnicodeSegmentation::graphemes(word.as_str(), true).count();
-                output.push_str(&count.to_string());
-            },
-            "len_bytes" => if let Some(value) = expand.string(variable, false) {
-                output.push_str(&value.as_bytes().len().to_string());
-            } else if is_expression(variable) {
-                let word = expand_string(variable, expand, false).join(" ");
-                output.push_str(&word.as_bytes().len().to_string());
-            },
-            "reverse" => if let Some(value) = expand.string(variable, false) {
-                let rev_graphs = UnicodeSegmentation::graphemes(value.as_str(), true).rev();
-                output.push_str(rev_graphs.collect::<String>().as_str());
-            } else if is_expression(variable) {
-                let word = expand_string(variable, expand, false).join(" ");
-                let rev_graphs = UnicodeSegmentation::graphemes(word.as_str(), true).rev();
-                output.push_str(rev_graphs.collect::<String>().as_str());
-            },
+            "len" => {
+                if variable.starts_with('@') || is_array(variable) {
+                    let expanded = expand_string(variable, expand, false);
+                    output.push_str(&expanded.len().to_string());
+                } else if let Some(value) = expand.string(variable, false) {
+                    let count = UnicodeSegmentation::graphemes(value.as_str(), true).count();
+                    output.push_str(&count.to_string());
+                } else if is_expression(variable) {
+                    let word = expand_string(variable, expand, false).join(" ");
+                    let count = UnicodeSegmentation::graphemes(word.as_str(), true).count();
+                    output.push_str(&count.to_string());
+                }
+            }
+            "len_bytes" => {
+                if let Some(value) = expand.string(variable, false) {
+                    output.push_str(&value.as_bytes().len().to_string());
+                } else if is_expression(variable) {
+                    let word = expand_string(variable, expand, false).join(" ");
+                    output.push_str(&word.as_bytes().len().to_string());
+                }
+            }
+            "reverse" => {
+                if let Some(value) = expand.string(variable, false) {
+                    let rev_graphs = UnicodeSegmentation::graphemes(value.as_str(), true).rev();
+                    output.push_str(rev_graphs.collect::<String>().as_str());
+                } else if is_expression(variable) {
+                    let word = expand_string(variable, expand, false).join(" ");
+                    let rev_graphs = UnicodeSegmentation::graphemes(word.as_str(), true).rev();
+                    output.push_str(rev_graphs.collect::<String>().as_str());
+                }
+            }
             "find" => {
                 let out = if let Some(value) = expand.string(variable, false) {
                     value.find(pattern.join(" ").as_str())
@@ -309,11 +315,8 @@ impl<'a> StringMethod<'a> {
                     small::String::new()
                 };
                 let second_array = pattern.array();
-                let first_maybe: Option<String> = if first_str != "" {
-                    Some(first_str.to_string())
-                } else {
-                    None
-                };
+                let first_maybe: Option<String> =
+                    if first_str != "" { Some(first_str.to_string()) } else { None };
                 match first_maybe {
                     Some(first) => output.push_str(&first),
                     None => {
@@ -541,7 +544,6 @@ mod test {
         assert_eq!(&*output, "FORD PREFECT");
     }
 
-
     #[test]
     fn test_trim_with_string() {
         let mut output = small::String::new();
diff --git a/src/lib/parser/shell_expand/words/mod.rs b/src/lib/parser/shell_expand/words/mod.rs
index 337323e47a2248673da764e5a52ea81ff206ebc9..a3e37fc0bdd8dd54532f1c95dbd1a5513543380a 100644
--- a/src/lib/parser/shell_expand/words/mod.rs
+++ b/src/lib/parser/shell_expand/words/mod.rs
@@ -25,11 +25,7 @@ bitflags! {
 }
 
 impl Flags {
-    pub(crate) fn new() -> Self {
-        Flags {
-            bits: 0,
-        }
-    }
+    pub(crate) fn new() -> Self { Flags { bits: 0 } }
 }
 
 #[derive(Debug, PartialEq, Clone)]
@@ -141,20 +137,22 @@ impl<'a, E: Expander + 'a> WordIterator<'a, E> {
                 b'\'' if !self.flags.contains(Flags::DQUOTE) => self.flags ^= Flags::SQUOTE,
                 b'"' if !self.flags.contains(Flags::SQUOTE) => self.flags ^= Flags::DQUOTE,
                 b'[' if !self.flags.intersects(Flags::SQUOTE | Flags::DQUOTE) => level += 1,
-                b']' if !self.flags.intersects(Flags::SQUOTE | Flags::DQUOTE) => if level == 0 {
-                    let elements =
-                        ArgumentSplitter::new(&self.data[start..self.read]).collect::<Vec<&str>>();
-                    self.read += 1;
+                b']' if !self.flags.intersects(Flags::SQUOTE | Flags::DQUOTE) => {
+                    if level == 0 {
+                        let elements = ArgumentSplitter::new(&self.data[start..self.read])
+                            .collect::<Vec<&str>>();
+                        self.read += 1;
 
-                    return if let Some(&b'[') = self.data.as_bytes().get(self.read) {
-                        let _ = iterator.next();
-                        WordToken::Array(elements, self.read_selection(iterator))
+                        return if let Some(&b'[') = self.data.as_bytes().get(self.read) {
+                            let _ = iterator.next();
+                            WordToken::Array(elements, self.read_selection(iterator))
+                        } else {
+                            WordToken::Array(elements, Select::All)
+                        };
                     } else {
-                        WordToken::Array(elements, Select::All)
-                    };
-                } else {
-                    level -= 1;
-                },
+                        level -= 1;
+                    }
+                }
                 _ => (),
             }
             self.read += 1;
@@ -171,7 +169,7 @@ impl<'a, E: Expander + 'a> WordIterator<'a, E> {
         let mut start = self.read;
         let mut level = 0;
         let mut elements = Vec::new();
-        while let Some(character) = iterator.next() {
+        for character in iterator {
             match character {
                 _ if self.flags.contains(Flags::BACKSL) => self.flags ^= Flags::BACKSL,
                 b'\\' => self.flags ^= Flags::BACKSL,
@@ -182,13 +180,15 @@ impl<'a, E: Expander + 'a> WordIterator<'a, E> {
                     start = self.read + 1;
                 }
                 b'{' if !self.flags.intersects(Flags::SQUOTE | Flags::DQUOTE) => level += 1,
-                b'}' if !self.flags.intersects(Flags::SQUOTE | Flags::DQUOTE) => if level == 0 {
-                    elements.push(&self.data[start..self.read]);
-                    self.read += 1;
-                    return WordToken::Brace(elements);
-                } else {
-                    level -= 1;
-                },
+                b'}' if !self.flags.intersects(Flags::SQUOTE | Flags::DQUOTE) => {
+                    if level == 0 {
+                        elements.push(&self.data[start..self.read]);
+                        self.read += 1;
+                        return WordToken::Brace(elements);
+                    } else {
+                        level -= 1;
+                    }
+                }
                 b'[' if !self.flags.intersects(Flags::SQUOTE | Flags::DQUOTE) => level += 1,
                 b']' if !self.flags.intersects(Flags::SQUOTE | Flags::DQUOTE) => level -= 1,
                 _ => (),
@@ -217,26 +217,28 @@ impl<'a, E: Expander + 'a> WordIterator<'a, E> {
                         level += 1;
                     }
                 }
-                b')' if !self.flags.contains(Flags::SQUOTE) => if level == 0 {
-                    let array_process_contents = &self.data[start..self.read];
-                    self.read += 1;
-                    return if let Some(&b'[') = self.data.as_bytes().get(self.read) {
-                        let _ = iterator.next();
-                        WordToken::ArrayProcess(
-                            array_process_contents,
-                            self.flags.contains(Flags::DQUOTE),
-                            self.read_selection(iterator),
-                        )
+                b')' if !self.flags.contains(Flags::SQUOTE) => {
+                    if level == 0 {
+                        let array_process_contents = &self.data[start..self.read];
+                        self.read += 1;
+                        return if let Some(&b'[') = self.data.as_bytes().get(self.read) {
+                            let _ = iterator.next();
+                            WordToken::ArrayProcess(
+                                array_process_contents,
+                                self.flags.contains(Flags::DQUOTE),
+                                self.read_selection(iterator),
+                            )
+                        } else {
+                            WordToken::ArrayProcess(
+                                array_process_contents,
+                                self.flags.contains(Flags::DQUOTE),
+                                Select::All,
+                            )
+                        };
                     } else {
-                        WordToken::ArrayProcess(
-                            array_process_contents,
-                            self.flags.contains(Flags::DQUOTE),
-                            Select::All,
-                        )
-                    };
-                } else {
-                    level -= 1;
-                },
+                        level -= 1;
+                    }
+                }
                 _ => (),
             }
             self.read += 1;
@@ -275,22 +277,28 @@ impl<'a, E: Expander + 'a> WordIterator<'a, E> {
                         level += 1;
                     }
                 }
-                b')' if !self.flags.contains(Flags::SQUOTE) => if level == 0 {
-                    let output = &self.data[start..self.read];
-                    self.read += 1;
-                    return if let Some(&b'[') = self.data.as_bytes().get(self.read) {
-                        let _ = iterator.next();
-                        WordToken::Process(
-                            output,
-                            self.flags.contains(Flags::DQUOTE),
-                            self.read_selection(iterator),
-                        )
+                b')' if !self.flags.contains(Flags::SQUOTE) => {
+                    if level == 0 {
+                        let output = &self.data[start..self.read];
+                        self.read += 1;
+                        return if let Some(&b'[') = self.data.as_bytes().get(self.read) {
+                            let _ = iterator.next();
+                            WordToken::Process(
+                                output,
+                                self.flags.contains(Flags::DQUOTE),
+                                self.read_selection(iterator),
+                            )
+                        } else {
+                            WordToken::Process(
+                                output,
+                                self.flags.contains(Flags::DQUOTE),
+                                Select::All,
+                            )
+                        };
                     } else {
-                        WordToken::Process(output, self.flags.contains(Flags::DQUOTE), Select::All)
-                    };
-                } else {
-                    level -= 1;
-                },
+                        level -= 1;
+                    }
+                }
                 _ => (),
             }
             self.read += 1;
@@ -338,7 +346,7 @@ impl<'a, E: Expander + 'a> WordIterator<'a, E> {
                         &self.data[start..self.read],
                         self.flags.contains(Flags::DQUOTE),
                         Select::All,
-                    )
+                    );
                 }
                 _ => (),
             }
@@ -370,10 +378,15 @@ impl<'a, E: Expander + 'a> WordIterator<'a, E> {
                         match character {
                             b'\'' => method_flags ^= Flags::SQUOTE,
                             b'"' => method_flags ^= Flags::DQUOTE,
-                            b'[' if !method_flags.intersects(Flags::SQUOTE | Flags::DQUOTE) => depth += 1,
-                            b']' if !method_flags.intersects(Flags::SQUOTE | Flags::DQUOTE) => depth -= 1,
+                            b'[' if !method_flags.intersects(Flags::SQUOTE | Flags::DQUOTE) => {
+                                depth += 1
+                            }
+                            b']' if !method_flags.intersects(Flags::SQUOTE | Flags::DQUOTE) => {
+                                depth -= 1
+                            }
                             b' ' if depth == 0
-                                && !method_flags.intersects(Flags::SQUOTE | Flags::DQUOTE) => {
+                                && !method_flags.intersects(Flags::SQUOTE | Flags::DQUOTE) =>
+                            {
                                 let variable = &self.data[start..self.read];
                                 self.read += 1;
                                 start = self.read;
@@ -439,7 +452,7 @@ impl<'a, E: Expander + 'a> WordIterator<'a, E> {
                         &self.data[start..self.read],
                         self.flags.contains(Flags::DQUOTE),
                         self.read_selection(iterator),
-                    )
+                    );
                 }
                 // Only alphanumerical and underscores are allowed in variable names
                 0...47 | 58...64 | 91...94 | 96 | 123...127 => {
@@ -447,7 +460,7 @@ impl<'a, E: Expander + 'a> WordIterator<'a, E> {
                         &self.data[start..self.read],
                         self.flags.contains(Flags::DQUOTE),
                         Select::All,
-                    )
+                    );
                 }
                 _ => (),
             }
@@ -467,7 +480,7 @@ impl<'a, E: Expander + 'a> WordIterator<'a, E> {
     {
         self.read += 1;
         let start = self.read;
-        while let Some(character) = iterator.next() {
+        for character in iterator {
             if let b']' = character {
                 let value =
                     expand_string(&self.data[start..self.read], self.expanders, false).join(" ");
@@ -503,10 +516,15 @@ impl<'a, E: Expander + 'a> WordIterator<'a, E> {
                         match character {
                             b'\'' => method_flags ^= Flags::SQUOTE,
                             b'"' => method_flags ^= Flags::DQUOTE,
-                            b'[' if !method_flags.intersects(Flags::SQUOTE | Flags::DQUOTE) => depth += 1,
-                            b']' if !method_flags.intersects(Flags::SQUOTE | Flags::DQUOTE) => depth -= 1,
+                            b'[' if !method_flags.intersects(Flags::SQUOTE | Flags::DQUOTE) => {
+                                depth += 1
+                            }
+                            b']' if !method_flags.intersects(Flags::SQUOTE | Flags::DQUOTE) => {
+                                depth -= 1
+                            }
                             b' ' if depth == 0
-                                && !method_flags.intersects(Flags::SQUOTE | Flags::DQUOTE) => {
+                                && !method_flags.intersects(Flags::SQUOTE | Flags::DQUOTE) =>
+                            {
                                 let variable = &self.data[start..self.read];
                                 self.read += 1;
                                 start = self.read;
@@ -599,11 +617,7 @@ impl<'a, E: Expander + 'a> WordIterator<'a, E> {
             self.read += 1;
         }
 
-        WordToken::Variable(
-            &self.data[start..],
-            self.flags.contains(Flags::DQUOTE),
-            Select::All,
-        )
+        WordToken::Variable(&self.data[start..], self.flags.contains(Flags::DQUOTE), Select::All)
     }
 
     // Contains the logic for parsing braced variables
@@ -612,7 +626,7 @@ impl<'a, E: Expander + 'a> WordIterator<'a, E> {
         I: Iterator<Item = u8>,
     {
         let start = self.read;
-        while let Some(character) = iterator.next() {
+        for character in iterator {
             if character == b'}' {
                 let output = &self.data[start..self.read];
                 self.read += 1;
@@ -632,25 +646,18 @@ impl<'a, E: Expander + 'a> WordIterator<'a, E> {
     {
         let start = self.read;
         self.read += 1;
-        while let Some(character) = iterator.next() {
-            if character == b' ' {
-                self.read += 1;
-            } else {
-                return WordToken::Whitespace(&self.data[start..self.read]);
+        for character in iterator {
+            if character != b' ' {
+                break;
             }
+            self.read += 1;
         }
 
         WordToken::Whitespace(&self.data[start..self.read])
     }
 
     pub(crate) fn new(data: &'a str, expanders: &'a E, do_glob: bool) -> WordIterator<'a, E> {
-        WordIterator {
-            data,
-            read: 0,
-            flags: Flags::empty(),
-            expanders,
-            do_glob,
-        }
+        WordIterator { data, read: 0, flags: Flags::empty(), expanders, do_glob }
     }
 }
 
@@ -700,7 +707,7 @@ impl<'a, E: Expander + 'a> Iterator for WordIterator<'a, E> {
                         break;
                     }
                     b' ' if !self.flags.intersects(Flags::DQUOTE | Flags::SQUOTE) => {
-                        return Some(self.whitespaces(&mut iterator))
+                        return Some(self.whitespaces(&mut iterator));
                     }
                     b'~' if !self.flags.intersects(Flags::DQUOTE | Flags::SQUOTE) => {
                         tilde = true;
@@ -829,7 +836,7 @@ impl<'a, E: Expander + 'a> Iterator for WordIterator<'a, E> {
                         unescape(&self.data[start..self.read]),
                         glob,
                         tilde,
-                    ))
+                    ));
                 }
                 b'$' | b'@' if !self.flags.contains(Flags::SQUOTE) => {
                     if let Some(&character) = self.data.as_bytes().get(self.read) {
@@ -868,11 +875,7 @@ impl<'a, E: Expander + 'a> Iterator for WordIterator<'a, E> {
         if start == self.read {
             None
         } else {
-            Some(WordToken::Normal(
-                unescape(&self.data[start..]),
-                glob,
-                tilde,
-            ))
+            Some(WordToken::Normal(unescape(&self.data[start..]), glob, tilde))
         }
     }
 }
diff --git a/src/lib/parser/shell_expand/words/tests.rs b/src/lib/parser/shell_expand/words/tests.rs
index 723958e3c08450e73d50457294d1e4a52c81c3cc..d5ffbd21f512022c2ca914bbddfd927f4212f1ec 100644
--- a/src/lib/parser/shell_expand/words/tests.rs
+++ b/src/lib/parser/shell_expand/words/tests.rs
@@ -157,11 +157,7 @@ fn words_process_with_quotes() {
     let expected = vec![
         WordToken::Normal("echo".into(), false, false),
         WordToken::Whitespace(" "),
-        WordToken::Process(
-            "git branch | rg '[*]' | awk '{print $2}'",
-            false,
-            Select::All,
-        ),
+        WordToken::Process("git branch | rg '[*]' | awk '{print $2}'", false, Select::All),
     ];
     compare(input, expected);
 
@@ -169,11 +165,7 @@ fn words_process_with_quotes() {
     let expected = vec![
         WordToken::Normal("echo".into(), false, false),
         WordToken::Whitespace(" "),
-        WordToken::Process(
-            "git branch | rg \"[*]\" | awk '{print $2}'",
-            false,
-            Select::All,
-        ),
+        WordToken::Process("git branch | rg \"[*]\" | awk '{print $2}'", false, Select::All),
     ];
     compare(input, expected);
 }
diff --git a/src/lib/parser/statement/case.rs b/src/lib/parser/statement/case.rs
index 52fb6d26c66ff7a9518d4545b5687e1423b7b3a0..dbbe4b8f94f177336466927e016946f2b7c12974 100644
--- a/src/lib/parser/statement/case.rs
+++ b/src/lib/parser/statement/case.rs
@@ -67,12 +67,14 @@ pub(crate) fn parse_case(
                 }
                 conditional = Some(string);
             }
-            Some(inner) => if argument.is_none() {
-                argument = Some(inner);
-                continue;
-            } else {
-                return Err(CaseError::ExtraVar(inner));
-            },
+            Some(inner) => {
+                if argument.is_none() {
+                    argument = Some(inner);
+                    continue;
+                } else {
+                    return Err(CaseError::ExtraVar(inner));
+                }
+            }
             None => (),
         }
         break;
@@ -90,10 +92,7 @@ mod tests {
             Ok((Some("test"), Some("test"), Some("exists".into()))),
             parse_case("test @ test if exists")
         );
-        assert_eq!(
-            Ok((Some("test"), Some("test"), None)),
-            parse_case("test @ test")
-        );
+        assert_eq!(Ok((Some("test"), Some("test"), None)), parse_case("test @ test"));
         assert_eq!(Ok((Some("test"), None, None)), parse_case("test"));
     }
 }
diff --git a/src/lib/parser/statement/functions.rs b/src/lib/parser/statement/functions.rs
index e07f5f12f78b3c1443f2b74e9b1c5daa9520a6bc..cdf3fac8d11e7b3d2bc2d3d3d0a27b817bb905e5 100644
--- a/src/lib/parser/statement/functions.rs
+++ b/src/lib/parser/statement/functions.rs
@@ -61,22 +61,10 @@ mod tests {
         assert_eq!(
             args,
             Ok(vec![
-                KeyBuf {
-                    name: "a".into(),
-                    kind: Primitive::Integer,
-                },
-                KeyBuf {
-                    name: "b".into(),
-                    kind: Primitive::Boolean,
-                },
-                KeyBuf {
-                    name: "c".into(),
-                    kind: Primitive::AnyArray,
-                },
-                KeyBuf {
-                    name: "d".into(),
-                    kind: Primitive::Any,
-                },
+                KeyBuf { name: "a".into(), kind: Primitive::Integer },
+                KeyBuf { name: "b".into(), kind: Primitive::Boolean },
+                KeyBuf { name: "c".into(), kind: Primitive::AnyArray },
+                KeyBuf { name: "d".into(), kind: Primitive::Any },
             ])
         );
         assert_eq!(description, Some("description"))
diff --git a/src/lib/parser/statement/parse.rs b/src/lib/parser/statement/parse.rs
index 9ef51c68cc7a8ea238aa6c44ca4e034d8a5af4cf..59b1fa423179eb1e1017d1950baec24a9017faf9 100644
--- a/src/lib/parser/statement/parse.rs
+++ b/src/lib/parser/statement/parse.rs
@@ -91,7 +91,7 @@ pub(crate) fn parse(code: &str) -> Statement {
                 else_if:    Vec::new(),
                 failure:    Vec::new(),
                 mode:       0,
-            }
+            };
         }
         "else" => return Statement::Else,
         _ if cmd.starts_with("else") => {
@@ -109,7 +109,7 @@ pub(crate) fn parse(code: &str) -> Statement {
             return collect(cmd[6..].trim_left(), |pipeline| Statement::While {
                 expression: vec![Statement::Pipeline(pipeline)],
                 statements: Vec::new(),
-            })
+            });
         }
         _ if cmd.starts_with("for ") => {
             let mut cmd = cmd[4..].trim_left();
@@ -118,16 +118,12 @@ pub(crate) fn parse(code: &str) -> Statement {
             if cmd.len() > 5 {
                 let mut cmdb = cmd.as_bytes();
                 for start in 0..cmd.len() - 4 {
-                    if &cmdb[start..start+4] == b" in " {
-                        variables = Some(
-                            cmd[..start].split_whitespace()
-                                .map(Into::into)
-                                .collect()
-                        );
+                    if &cmdb[start..start + 4] == b" in " {
+                        variables = Some(cmd[..start].split_whitespace().map(Into::into).collect());
 
                         cmd = cmd[start + 3..].trim();
 
-                        break
+                        break;
                     }
                 }
             }
@@ -135,9 +131,7 @@ pub(crate) fn parse(code: &str) -> Statement {
             return match variables {
                 Some(variables) => Statement::For {
                     variables,
-                    values:     ArgumentSplitter::new(cmd)
-                        .map(small::String::from)
-                        .collect(),
+                    values: ArgumentSplitter::new(cmd).map(small::String::from).collect(),
                     statements: Vec::new(),
                 },
                 None => {
@@ -166,18 +160,13 @@ pub(crate) fn parse(code: &str) -> Statement {
                 }
             };
 
-            return Statement::Case(Case {
-                value,
-                binding,
-                conditional,
-                statements: Vec::new(),
-            });
+            return Statement::Case(Case { value, binding, conditional, statements: Vec::new() });
         }
         _ if cmd.starts_with("match ") => {
             return Statement::Match {
                 expression: cmd[6..].trim_left().into(),
                 cases:      Vec::new(),
-            }
+            };
         }
         _ if cmd.starts_with("fn ") => {
             let cmd = cmd[3..].trim_left();
@@ -200,7 +189,7 @@ pub(crate) fn parse(code: &str) -> Statement {
                         name: name.into(),
                         args,
                         statements: Vec::new(),
-                    }
+                    };
                 }
                 Err(why) => {
                     eprintln!("ion: function argument error: {}", why);
@@ -218,17 +207,17 @@ pub(crate) fn parse(code: &str) -> Statement {
                 }
                 break;
             }
-            return Statement::Time(Box::new(parse(timed)))
+            return Statement::Time(Box::new(parse(timed)));
         }
         _ if cmd.eq("time") => return Statement::Time(Box::new(Statement::Default)),
         _ if cmd.starts_with("and ") => {
-            return Statement::And(Box::new(parse(cmd[3..].trim_left())))
+            return Statement::And(Box::new(parse(cmd[3..].trim_left())));
         }
         _ if cmd.eq("and") => return Statement::And(Box::new(Statement::Default)),
         _ if cmd.starts_with("or ") => return Statement::Or(Box::new(parse(cmd[2..].trim_left()))),
         _ if cmd.eq("or") => return Statement::Or(Box::new(Statement::Default)),
         _ if cmd.starts_with("not ") => {
-            return Statement::Not(Box::new(parse(cmd[3..].trim_left())))
+            return Statement::Not(Box::new(parse(cmd[3..].trim_left())));
         }
         _ if cmd.starts_with("! ") => return Statement::Not(Box::new(parse(cmd[1..].trim_left()))),
         _ if cmd.eq("not") | cmd.eq("!") => return Statement::Not(Box::new(Statement::Default)),
@@ -254,18 +243,18 @@ mod tests {
         assert_eq!(
             parse("for x y z in 1..=10"),
             Statement::For {
-                variables: vec!["x", "y", "z"].into_iter().map(Into::into).collect(),
-                values: vec!["1..=10"].into_iter().map(Into::into).collect(),
-                statements: Vec::new()
+                variables:  vec!["x", "y", "z"].into_iter().map(Into::into).collect(),
+                values:     vec!["1..=10"].into_iter().map(Into::into).collect(),
+                statements: Vec::new(),
             }
         );
 
         assert_eq!(
             parse("for  x  in  {1..=10} {1..=10}"),
             Statement::For {
-                variables: vec!["x"].into_iter().map(Into::into).collect(),
-                values: vec!["{1..=10}", "{1..=10}"].into_iter().map(Into::into).collect(),
-                statements: Vec::new()
+                variables:  vec!["x"].into_iter().map(Into::into).collect(),
+                values:     vec!["{1..=10}", "{1..=10}"].into_iter().map(Into::into).collect(),
+                statements: Vec::new(),
             }
         );
     }
@@ -359,14 +348,8 @@ mod tests {
             description: None,
             name:        "bob".into(),
             args:        vec![
-                KeyBuf {
-                    name: "a".into(),
-                    kind: Primitive::Any,
-                },
-                KeyBuf {
-                    name: "b".into(),
-                    kind: Primitive::Any,
-                },
+                KeyBuf { name: "a".into(), kind: Primitive::Any },
+                KeyBuf { name: "b".into(), kind: Primitive::Any },
             ],
             statements:  Default::default(),
         };
@@ -381,14 +364,8 @@ mod tests {
             description: Some("bob is a nice function".into()),
             name:        "bob".into(),
             args:        vec![
-                KeyBuf {
-                    name: "a".into(),
-                    kind: Primitive::Any,
-                },
-                KeyBuf {
-                    name: "b".into(),
-                    kind: Primitive::Any,
-                },
+                KeyBuf { name: "a".into(), kind: Primitive::Any },
+                KeyBuf { name: "b".into(), kind: Primitive::Any },
             ],
             statements:  vec![],
         };
diff --git a/src/lib/parser/statement/splitter.rs b/src/lib/parser/statement/splitter.rs
index 8805481009047be1673fe62c5dc5a59b6938e023..72fe15def0f1215a9e4edeb7b07a0cf06abca195 100644
--- a/src/lib/parser/statement/splitter.rs
+++ b/src/lib/parser/statement/splitter.rs
@@ -172,10 +172,7 @@ impl<'a> Iterator for StatementSplitter<'a> {
                 {
                     // If we are just ending the braced section continue as normal
                     if error.is_none() {
-                        error = Some(StatementError::InvalidCharacter(
-                            character as char,
-                            self.read,
-                        ))
+                        error = Some(StatementError::InvalidCharacter(character as char, self.read))
                     }
                 }
                 b'\'' if !self.flags.contains(Flags::DQUOTE) => {
@@ -198,28 +195,22 @@ impl<'a> Iterator for StatementSplitter<'a> {
                 }
                 b'{' if !self.flags.contains(Flags::DQUOTE) => self.brace_level += 1,
                 b'}' if self.flags.contains(Flags::VBRACE) => self.flags.toggle(Flags::VBRACE),
-                b'}' if !self.flags.contains(Flags::DQUOTE) => if self.brace_level == 0 {
-                    if error.is_none() {
-                        error = Some(StatementError::InvalidCharacter(
-                            character as char,
-                            self.read,
-                        ))
+                b'}' if !self.flags.contains(Flags::DQUOTE) => {
+                    if self.brace_level == 0 {
+                        if error.is_none() {
+                            error =
+                                Some(StatementError::InvalidCharacter(character as char, self.read))
+                        }
+                    } else {
+                        self.brace_level -= 1;
                     }
-                } else {
-                    self.brace_level -= 1;
-                },
+                }
                 b'(' if self.flags.contains(Flags::MATHEXPR) => {
                     self.math_paren_level += 1;
                 }
-                b'(' if !self
-                    .flags
-                    .intersects(Flags::COMM_1 | Flags::VARIAB | Flags::ARRAY) =>
-                {
+                b'(' if !self.flags.intersects(Flags::COMM_1 | Flags::VARIAB | Flags::ARRAY) => {
                     if error.is_none() && !self.flags.contains(Flags::DQUOTE) {
-                        error = Some(StatementError::InvalidCharacter(
-                            character as char,
-                            self.read,
-                        ))
+                        error = Some(StatementError::InvalidCharacter(character as char, self.read))
                     }
                 }
                 b'(' if self.flags.intersects(Flags::COMM_1 | Flags::METHOD) => {
@@ -238,32 +229,33 @@ impl<'a> Iterator for StatementSplitter<'a> {
                 b'(' if self.flags.intersects(Flags::VARIAB | Flags::ARRAY) => {
                     self.flags = (self.flags - (Flags::VARIAB | Flags::ARRAY)) | Flags::METHOD;
                 }
-                b')' if self.flags.contains(Flags::MATHEXPR) => if self.math_paren_level == 0 {
-                    if self.data.as_bytes().len() <= self.read {
-                        if error.is_none() {
-                            error = Some(StatementError::UnterminatedArithmetic)
+                b')' if self.flags.contains(Flags::MATHEXPR) => {
+                    if self.math_paren_level == 0 {
+                        if self.data.as_bytes().len() <= self.read {
+                            if error.is_none() {
+                                error = Some(StatementError::UnterminatedArithmetic)
+                            }
+                        } else {
+                            let next_character = self.data.as_bytes()[self.read] as char;
+                            if next_character == ')' {
+                                self.flags = (self.flags - Flags::MATHEXPR) | Flags::POST_MATHEXPR;
+                            } else if error.is_none() {
+                                error = Some(StatementError::InvalidCharacter(
+                                    next_character,
+                                    self.read,
+                                ));
+                            }
                         }
                     } else {
-                        let next_character = self.data.as_bytes()[self.read] as char;
-                        if next_character == ')' {
-                            self.flags = (self.flags - Flags::MATHEXPR) | Flags::POST_MATHEXPR;
-                        } else if error.is_none() {
-                            error =
-                                Some(StatementError::InvalidCharacter(next_character, self.read));
-                        }
+                        self.math_paren_level -= 1;
                     }
-                } else {
-                    self.math_paren_level -= 1;
-                },
+                }
                 b')' if self.flags.contains(Flags::METHOD) && self.paren_level == 0 => {
                     self.flags ^= Flags::METHOD;
                 }
                 b')' if self.paren_level == 0 => {
                     if error.is_none() && !self.flags.contains(Flags::DQUOTE) {
-                        error = Some(StatementError::InvalidCharacter(
-                            character as char,
-                            self.read,
-                        ))
+                        error = Some(StatementError::InvalidCharacter(character as char, self.read))
                     }
                 }
                 b')' => self.paren_level -= 1,
@@ -298,7 +290,8 @@ impl<'a> Iterator for StatementSplitter<'a> {
                 }
 
                 b'#' if self.read == 1
-                    || (!self.flags.contains(Flags::DQUOTE) && self.paren_level == 0
+                    || (!self.flags.contains(Flags::DQUOTE)
+                        && self.paren_level == 0
                         && match self.data.as_bytes()[self.read - 2] {
                             b' ' | b'\t' => true,
                             _ => false,
@@ -333,13 +326,15 @@ impl<'a> Iterator for StatementSplitter<'a> {
                     }
                 }
                 // [^A-Za-z0-9_]
-                byte => if self.flags.intersects(Flags::VARIAB | Flags::ARRAY) {
-                    self.flags -= if is_invalid(byte) {
-                        Flags::VARIAB | Flags::ARRAY
-                    } else {
-                        Flags::empty()
-                    };
-                },
+                byte => {
+                    if self.flags.intersects(Flags::VARIAB | Flags::ARRAY) {
+                        self.flags -= if is_invalid(byte) {
+                            Flags::VARIAB | Flags::ARRAY
+                        } else {
+                            Flags::empty()
+                        };
+                    }
+                }
             }
             self.flags -= Flags::COMM_1 | Flags::COMM_2;
         }
@@ -372,9 +367,9 @@ impl<'a> Iterator for StatementSplitter<'a> {
                         }
                         b'|' => Some(Err(StatementError::ExpectedCommandButFound("pipe"))),
                         b'&' => Some(Err(StatementError::ExpectedCommandButFound("&"))),
-                        b'*' | b'%' | b'?' | b'{' | b'}' => Some(Err(
-                            StatementError::IllegalCommandName(String::from(output)),
-                        )),
+                        b'*' | b'%' | b'?' | b'{' | b'}' => {
+                            Some(Err(StatementError::IllegalCommandName(String::from(output))))
+                        }
                         _ => Some(Ok(self.get_statement_from(output))),
                     }
                 }
@@ -395,10 +390,7 @@ fn syntax_errors() {
 
     let command = ">echo";
     let results = StatementSplitter::new(command).collect::<Vec<_>>();
-    assert_eq!(
-        results[0],
-        Err(StatementError::ExpectedCommandButFound("redirection"))
-    );
+    assert_eq!(results[0], Err(StatementError::ExpectedCommandButFound("redirection")));
     assert_eq!(results.len(), 1);
 
     let command = "echo $((foo bar baz)";
@@ -411,14 +403,8 @@ fn syntax_errors() {
 fn methods() {
     let command = "echo $join(array, ', '); echo @join(var, ', ')";
     let statements = StatementSplitter::new(command).collect::<Vec<_>>();
-    assert_eq!(
-        statements[0],
-        Ok(StatementVariant::Default("echo $join(array, ', ')"))
-    );
-    assert_eq!(
-        statements[1],
-        Ok(StatementVariant::Default("echo @join(var, ', ')"))
-    );
+    assert_eq!(statements[0], Ok(StatementVariant::Default("echo $join(array, ', ')")));
+    assert_eq!(statements[1], Ok(StatementVariant::Default("echo @join(var, ', ')")));
     assert_eq!(statements.len(), 2);
 }
 
@@ -434,10 +420,7 @@ fn processes() {
 fn array_processes() {
     let command = "echo @(echo one; sleep 1); echo @(echo one; sleep 1)";
     for statement in StatementSplitter::new(command) {
-        assert_eq!(
-            statement,
-            Ok(StatementVariant::Default("echo @(echo one; sleep 1)"))
-        );
+        assert_eq!(statement, Ok(StatementVariant::Default("echo @(echo one; sleep 1)")));
     }
 }
 
@@ -454,14 +437,8 @@ fn quotes() {
     let command = "echo \"This ;'is a test\"; echo 'This ;\" is also a test'";
     let results = StatementSplitter::new(command).collect::<Vec<_>>();
     assert_eq!(results.len(), 2);
-    assert_eq!(
-        results[0],
-        Ok(StatementVariant::Default("echo \"This ;'is a test\""))
-    );
-    assert_eq!(
-        results[1],
-        Ok(StatementVariant::Default("echo 'This ;\" is also a test'"))
-    );
+    assert_eq!(results[0], Ok(StatementVariant::Default("echo \"This ;'is a test\"")));
+    assert_eq!(results[1], Ok(StatementVariant::Default("echo 'This ;\" is also a test'")));
 }
 
 #[test]
@@ -469,10 +446,7 @@ fn comments() {
     let command = "echo $(echo one # two); echo three # four";
     let results = StatementSplitter::new(command).collect::<Vec<_>>();
     assert_eq!(results.len(), 2);
-    assert_eq!(
-        results[0],
-        Ok(StatementVariant::Default("echo $(echo one # two)"))
-    );
+    assert_eq!(results[0], Ok(StatementVariant::Default("echo $(echo one # two)")));
     assert_eq!(results[1], Ok(StatementVariant::Default("echo three")));
 }
 
@@ -515,28 +489,12 @@ fn variants() {
     let command = r#"echo "Hello!"; echo "How are you doing?" && echo "I'm just an ordinary test." || echo "Helping by making sure your code works right."; echo "Have a good day!""#;
     let results = StatementSplitter::new(command).collect::<Vec<_>>();
     assert_eq!(results.len(), 5);
-    assert_eq!(
-        results[0],
-        Ok(StatementVariant::Default(r#"echo "Hello!""#))
-    );
-    assert_eq!(
-        results[1],
-        Ok(StatementVariant::Default(r#"echo "How are you doing?""#))
-    );
-    assert_eq!(
-        results[2],
-        Ok(StatementVariant::And(
-            r#"echo "I'm just an ordinary test.""#
-        ))
-    );
+    assert_eq!(results[0], Ok(StatementVariant::Default(r#"echo "Hello!""#)));
+    assert_eq!(results[1], Ok(StatementVariant::Default(r#"echo "How are you doing?""#)));
+    assert_eq!(results[2], Ok(StatementVariant::And(r#"echo "I'm just an ordinary test.""#)));
     assert_eq!(
         results[3],
-        Ok(StatementVariant::Or(
-            r#"echo "Helping by making sure your code works right.""#
-        ))
-    );
-    assert_eq!(
-        results[4],
-        Ok(StatementVariant::Default(r#"echo "Have a good day!""#))
+        Ok(StatementVariant::Or(r#"echo "Helping by making sure your code works right.""#))
     );
+    assert_eq!(results[4], Ok(StatementVariant::Default(r#"echo "Have a good day!""#)));
 }
diff --git a/src/lib/shell/assignments.rs b/src/lib/shell/assignments.rs
index 562a701bcc964d6f0c880dd0fb9f3563dabc0157..cc2e1e9051563d8fe335aa3cd0ac8dd82dcfbbe1 100644
--- a/src/lib/shell/assignments.rs
+++ b/src/lib/shell/assignments.rs
@@ -123,10 +123,19 @@ impl VariableStore for Shell {
                                 .unwrap_or_else(|| "0".into());
 
                             let result = math(&lhs, &key.kind, operator, &value, |value| {
-                                let str_value = unsafe {str::from_utf8_unchecked(value)};
+                                let str_value = unsafe { str::from_utf8_unchecked(value) };
                                 if key_name == "PATH" && str_value.find('~').is_some() {
-                                    let final_value = str_value.replace("~", env::var("HOME").as_ref().map(|s| s.as_str()).unwrap_or("~"));
-                                    env::set_var(key_name, &OsStr::from_bytes(final_value.as_bytes()))
+                                    let final_value = str_value.replace(
+                                        "~",
+                                        env::var("HOME")
+                                            .as_ref()
+                                            .map(|s| s.as_str())
+                                            .unwrap_or("~"),
+                                    );
+                                    env::set_var(
+                                        key_name,
+                                        &OsStr::from_bytes(final_value.as_bytes()),
+                                    )
                                 } else {
                                     env::set_var(key_name, &OsStr::from_bytes(value))
                                 }
@@ -161,10 +170,9 @@ impl VariableStore for Shell {
                 list_vars(&self);
                 return SUCCESS;
             }
-            LocalAction::Assign(ref keys, op, ref vals) => (
-                AssignmentActions::new(keys, op, vals),
-                AssignmentActions::new(keys, op, vals),
-            ),
+            LocalAction::Assign(ref keys, op, ref vals) => {
+                (AssignmentActions::new(keys, op, vals), AssignmentActions::new(keys, op, vals))
+            }
         };
         for action in actions_step1 {
             match action {
@@ -255,7 +263,8 @@ impl VariableStore for Shell {
                                             .iter()
                                             .filter(|item| {
                                                 values.iter().all(|value| *item != value)
-                                            }).cloned()
+                                            })
+                                            .cloned()
                                             .collect();
                                     }
                                     None => {
@@ -375,9 +384,7 @@ impl VariableStore for Shell {
                                         }
                                     };
 
-                                    let action: Box<
-                                        dyn Fn(f64) -> f64,
-                                    > = match operator {
+                                    let action: Box<dyn Fn(f64) -> f64> = match operator {
                                         Operator::Add => Box::new(|src| src + value),
                                         Operator::Divide => Box::new(|src| src / value),
                                         Operator::Subtract => Box::new(|src| src - value),
@@ -432,13 +439,10 @@ impl VariableStore for Shell {
         for action in actions_step2 {
             match action {
                 Ok(Action::UpdateArray(key, operator, ..)) => {
-                    if operator == Operator::OptionalEqual {
-                        match self.variables.get_ref(key.name) {
-                            Some(_) => {
-                                continue;
-                            }
-                            _ => (),
-                        };
+                    if operator == Operator::OptionalEqual
+                        && self.variables.get_ref(key.name).is_some()
+                    {
+                        continue;
                     }
                     match collected.remove(key.name) {
                         hmap @ Some(VariableType::HashMap(_)) => {
@@ -468,33 +472,34 @@ impl VariableStore for Shell {
                         Some(VariableType::Str(value)) => {
                             if let Primitive::Indexed(ref index_value, ref index_kind) = key.kind {
                                 match value_check(self, index_value, index_kind) {
-                                    Ok(VariableType::Str(ref index)) => {
-                                        match self.variables.get_mut(key.name) {
-                                            Some(VariableType::HashMap(hmap)) => {
-                                                hmap.insert(index.clone(), VariableType::Str(value));
-                                            }
-                                            Some(VariableType::BTreeMap(bmap)) => {
-                                                bmap.insert(index.clone(), VariableType::Str(value));
-                                            }
-                                            Some(VariableType::Array(array)) => {
-                                                let index_num = match index.parse::<usize>() {
-                                                    Ok(num) => num,
-                                                    Err(_) => {
-                                                        eprintln!(
-                                                            "ion: index variable does not contain \
-                                                             a numeric value: {}",
-                                                            index
-                                                        );
-                                                        return FAILURE;
-                                                    }
-                                                };
-                                                if let Some(val) = array.get_mut(index_num) {
-                                                    *val = value;
+                                    Ok(VariableType::Str(ref index)) => match self
+                                        .variables
+                                        .get_mut(key.name)
+                                    {
+                                        Some(VariableType::HashMap(hmap)) => {
+                                            hmap.insert(index.clone(), VariableType::Str(value));
+                                        }
+                                        Some(VariableType::BTreeMap(bmap)) => {
+                                            bmap.insert(index.clone(), VariableType::Str(value));
+                                        }
+                                        Some(VariableType::Array(array)) => {
+                                            let index_num = match index.parse::<usize>() {
+                                                Ok(num) => num,
+                                                Err(_) => {
+                                                    eprintln!(
+                                                        "ion: index variable does not contain a \
+                                                         numeric value: {}",
+                                                        index
+                                                    );
+                                                    return FAILURE;
                                                 }
+                                            };
+                                            if let Some(val) = array.get_mut(index_num) {
+                                                *val = value;
                                             }
-                                            _ => (),
                                         }
-                                    }
+                                        _ => (),
+                                    },
                                     Ok(VariableType::Array(_)) => {
                                         eprintln!("ion: index variable cannot be an array");
                                         return FAILURE;
@@ -519,13 +524,10 @@ impl VariableStore for Shell {
                     }
                 }
                 Ok(Action::UpdateString(key, operator, ..)) => {
-                    if operator == Operator::OptionalEqual {
-                        match self.variables.get_ref(key.name) {
-                            Some(_) => {
-                                continue;
-                            }
-                            _ => (),
-                        };
+                    if operator == Operator::OptionalEqual
+                        && self.variables.get_ref(key.name).is_some()
+                    {
+                        continue;
                     }
                     match collected.remove(key.name) {
                         str_ @ Some(VariableType::Str(_)) => {
@@ -550,7 +552,7 @@ enum MathError {
     RHS,
     LHS,
     Unsupported,
-    CalculationError
+    CalculationError,
 }
 
 impl Display for MathError {
@@ -559,30 +561,30 @@ impl Display for MathError {
             MathError::RHS => write!(fmt, "right hand side has invalid type"),
             MathError::LHS => write!(fmt, "left hand side has invalid type"),
             MathError::Unsupported => write!(fmt, "type does not support operation"),
-            MathError::CalculationError => write!(fmt, "cannot calculate given operation")
+            MathError::CalculationError => write!(fmt, "cannot calculate given operation"),
         }
     }
 }
 
 fn parse_f64<F: Fn(f64, f64) -> f64>(lhs: &str, rhs: &str, operation: F) -> Result<f64, MathError> {
-    lhs.parse::<f64>()
-        .map_err(|_| MathError::LHS)
-        .and_then(|lhs| {
-            rhs.parse::<f64>()
-                .map_err(|_| MathError::RHS)
-                .map(|rhs| operation(lhs, rhs))
-        })
+    lhs.parse::<f64>().map_err(|_| MathError::LHS).and_then(|lhs| {
+        rhs.parse::<f64>().map_err(|_| MathError::RHS).map(|rhs| operation(lhs, rhs))
+    })
 }
 
-fn parse_i64<F: Fn(i64, i64) -> Option<i64>>(lhs: &str, rhs: &str, operation: F) -> Result<i64, MathError> {
+fn parse_i64<F: Fn(i64, i64) -> Option<i64>>(
+    lhs: &str,
+    rhs: &str,
+    operation: F,
+) -> Result<i64, MathError> {
     let lhs = match lhs.parse::<i64>() {
         Ok(e) => Ok(e),
-        Err(_) => Err(MathError::LHS)
+        Err(_) => Err(MathError::LHS),
     };
     if let Ok(lhs) = lhs {
         let rhs = match rhs.parse::<i64>() {
             Ok(e) => Ok(e),
-            Err(_) => Err(MathError::RHS)
+            Err(_) => Err(MathError::RHS),
         };
         if let Ok(rs) = rhs {
             let ret = operation(lhs, rs);
@@ -613,76 +615,69 @@ fn math<'a, F: FnMut(&[u8])>(
     mut writefn: F,
 ) -> Result<(), MathError> {
     match operator {
-        Operator::Add => if Primitive::Any == *key || Primitive::Float == *key {
-            writefn(
-                parse_f64(lhs, value, |lhs, rhs| lhs + rhs)?
-                    .to_string()
-                    .as_bytes(),
-            );
-        } else if let Primitive::Integer = key {
-            write_integer(parse_i64(lhs, value, |lhs, rhs| Some(lhs + rhs))?, writefn);
-        } else {
-            return Err(MathError::Unsupported);
-        },
+        Operator::Add => {
+            if Primitive::Any == *key || Primitive::Float == *key {
+                writefn(parse_f64(lhs, value, |lhs, rhs| lhs + rhs)?.to_string().as_bytes());
+            } else if let Primitive::Integer = key {
+                write_integer(parse_i64(lhs, value, |lhs, rhs| Some(lhs + rhs))?, writefn);
+            } else {
+                return Err(MathError::Unsupported);
+            }
+        }
         Operator::Divide => {
             if Primitive::Any == *key || Primitive::Float == *key || Primitive::Integer == *key {
-                writefn(
-                    parse_f64(lhs, value, |lhs, rhs| lhs / rhs)?
-                        .to_string()
-                        .as_bytes(),
+                writefn(parse_f64(lhs, value, |lhs, rhs| lhs / rhs)?.to_string().as_bytes());
+            } else {
+                return Err(MathError::Unsupported);
+            }
+        }
+        Operator::IntegerDivide => {
+            if Primitive::Any == *key || Primitive::Float == *key {
+                write_integer(
+                    parse_i64(lhs, value, |lhs, rhs| {
+                        // We want to make sure we don't divide by zero, so instead, we give them a None as a result to signify that we were unable to calculate the result.
+                        if rhs == 0 {
+                            None
+                        } else {
+                            Some(lhs / rhs)
+                        }
+                    })?,
+                    writefn,
+                );
+            } else {
+                return Err(MathError::Unsupported);
+            }
+        }
+        Operator::Subtract => {
+            if Primitive::Any == *key || Primitive::Float == *key {
+                writefn(parse_f64(lhs, value, |lhs, rhs| lhs - rhs)?.to_string().as_bytes());
+            } else if let Primitive::Integer = key {
+                write_integer(parse_i64(lhs, value, |lhs, rhs| Some(lhs - rhs))?, writefn);
+            } else {
+                return Err(MathError::Unsupported);
+            }
+        }
+        Operator::Multiply => {
+            if Primitive::Any == *key || Primitive::Float == *key {
+                writefn(parse_f64(lhs, value, |lhs, rhs| lhs * rhs)?.to_string().as_bytes());
+            } else if let Primitive::Integer = key {
+                write_integer(parse_i64(lhs, value, |lhs, rhs| Some(lhs * rhs))?, writefn);
+            } else {
+                return Err(MathError::Unsupported);
+            }
+        }
+        Operator::Exponent => {
+            if Primitive::Any == *key || Primitive::Float == *key {
+                writefn(parse_f64(lhs, value, |lhs, rhs| lhs.powf(rhs))?.to_string().as_bytes());
+            } else if let Primitive::Integer = key {
+                write_integer(
+                    parse_i64(lhs, value, |lhs, rhs| Some(lhs.pow(rhs as u32)))?,
+                    writefn,
                 );
             } else {
                 return Err(MathError::Unsupported);
             }
         }
-        Operator::IntegerDivide => if Primitive::Any == *key || Primitive::Float == *key {
-            write_integer(parse_i64(lhs, value, |lhs, rhs| {
-                // We want to make sure we don't divide by zero, so instead, we give them a None as a result to signify that we were unable to calculate the result.
-                if rhs == 0 {
-                    None
-                } else {
-                    Some(lhs / rhs)
-                }
-            })?, writefn);
-        } else {
-            return Err(MathError::Unsupported);
-        },
-        Operator::Subtract => if Primitive::Any == *key || Primitive::Float == *key {
-            writefn(
-                parse_f64(lhs, value, |lhs, rhs| lhs - rhs)?
-                    .to_string()
-                    .as_bytes(),
-            );
-        } else if let Primitive::Integer = key {
-            write_integer(parse_i64(lhs, value, |lhs, rhs| Some(lhs - rhs))?, writefn);
-        } else {
-            return Err(MathError::Unsupported);
-        },
-        Operator::Multiply => if Primitive::Any == *key || Primitive::Float == *key {
-            writefn(
-                parse_f64(lhs, value, |lhs, rhs| lhs * rhs)?
-                    .to_string()
-                    .as_bytes(),
-            );
-        } else if let Primitive::Integer = key {
-            write_integer(parse_i64(lhs, value, |lhs, rhs| Some(lhs * rhs))?, writefn);
-        } else {
-            return Err(MathError::Unsupported);
-        },
-        Operator::Exponent => if Primitive::Any == *key || Primitive::Float == *key {
-            writefn(
-                parse_f64(lhs, value, |lhs, rhs| lhs.powf(rhs))?
-                    .to_string()
-                    .as_bytes(),
-            );
-        } else if let Primitive::Integer = key {
-            write_integer(
-                parse_i64(lhs, value, |lhs, rhs| Some(lhs.pow(rhs as u32)))?,
-                writefn,
-            );
-        } else {
-            return Err(MathError::Unsupported);
-        },
         Operator::Equal => writefn(value.as_bytes()),
         _ => return Err(MathError::Unsupported),
     };
diff --git a/src/lib/shell/binary/designators.rs b/src/lib/shell/binary/designators.rs
index ea54b679e0f89e4ab0642fc7f4e4e706b24787e9..be01ed222e2739a1447f25317a9e2173695da558 100644
--- a/src/lib/shell/binary/designators.rs
+++ b/src/lib/shell/binary/designators.rs
@@ -32,15 +32,19 @@ fn command(text: &str) -> &str { ArgumentSplitter::new(text).next().unwrap_or(te
 
 fn args(text: &str) -> &str {
     let bytes = text.as_bytes();
-    bytes.iter()
+    bytes
+        .iter()
         // Obtain position of the first space character,
         .position(|&x| x == b' ')
         // and then obtain the arguments to the command.
-        .and_then(|fp| bytes[fp+1..].iter()
-            // Find the position of the first character in the first argument.
-            .position(|&x| x != b' ')
-            // Then slice the argument string from the original command.
-            .map(|sp| &text[fp+sp+1..]))
+        .and_then(|fp| {
+            bytes[fp + 1..]
+                .iter()
+                // Find the position of the first character in the first argument.
+                .position(|&x| x != b' ')
+                // Then slice the argument string from the original command.
+                .map(|sp| &text[fp + sp + 1..])
+        })
         // Unwrap the arguments string if it exists, else return the original string.
         .unwrap_or(text)
 }
diff --git a/src/lib/shell/binary/mod.rs b/src/lib/shell/binary/mod.rs
index aff6d45e7c7f13f6bc963fbc91b1230ebf6fb2f2..41370c47c5179ce9e1069ca264dc07828fc2bf18 100644
--- a/src/lib/shell/binary/mod.rs
+++ b/src/lib/shell/binary/mod.rs
@@ -5,7 +5,8 @@ mod readln;
 mod terminate;
 
 use self::{
-    prompt::{prompt, prompt_fn}, readln::readln,
+    prompt::{prompt, prompt_fn},
+    readln::readln,
     terminate::{terminate_quotes, terminate_script_quotes},
 };
 use super::{status::*, FlowLogic, Shell, ShellHistory};
@@ -94,9 +95,7 @@ impl Binary for Shell {
             let mut context = Context::new();
             context.word_divider_fn = Box::new(word_divide);
             if "1" == self.get_str_or_empty("HISTFILE_ENABLED") {
-                let path = self
-                    .get::<types::Str>("HISTFILE")
-                    .expect("shell didn't set HISTFILE");
+                let path = self.get::<types::Str>("HISTFILE").expect("shell didn't set HISTFILE");
                 if !Path::new(path.as_str()).exists() {
                     eprintln!("ion: creating history file at \"{}\"", path);
                 }
@@ -107,16 +106,15 @@ impl Binary for Shell {
 
         self.evaluate_init_file();
 
-        self.variables.set(
-            "args",
-            iter::once(env::args().next().unwrap().into()).collect::<types::Array>(),
-        );
+        self.variables
+            .set("args", iter::once(env::args().next().unwrap().into()).collect::<types::Array>());
 
         loop {
             if let Some(command) = self.readln() {
                 if !command.is_empty() {
                     if let Ok(command) = self.terminate_quotes(command.replace("\\\n", "")) {
-                        let cmd: &str = &designators::expand_designators(&self, command.trim_right());
+                        let cmd: &str =
+                            &designators::expand_designators(&self, command.trim_right());
                         self.on_command(&cmd);
                         self.save_command(&cmd);
                     } else {
@@ -231,9 +229,5 @@ where
 
 fn word_divide(buf: &Buffer) -> Vec<(usize, usize)> {
     // -> impl Iterator<Item = (usize, usize)> + 'a
-    WordDivide {
-        iter:       buf.chars().cloned().enumerate(),
-        count:      0,
-        word_start: None,
-    }.collect() // TODO: return iterator directly :D
+    WordDivide { iter: buf.chars().cloned().enumerate(), count: 0, word_start: None }.collect() // TODO: return iterator directly :D
 }
diff --git a/src/lib/shell/binary/prompt.rs b/src/lib/shell/binary/prompt.rs
index 2a181c5d289165cdf5046625f262a28030342dea..f8e1023b286d18c5bfd45b4e1d21f11509d260a5 100644
--- a/src/lib/shell/binary/prompt.rs
+++ b/src/lib/shell/binary/prompt.rs
@@ -4,8 +4,8 @@ use std::{io::Read, process};
 use sys;
 
 pub(crate) fn prompt(shell: &mut Shell) -> String {
-    let blocks = shell.flow_control.block.len()
-        + if shell.flags & UNTERMINATED != 0 { 1 } else { 0 };
+    let blocks =
+        shell.flow_control.block.len() + if shell.flags & UNTERMINATED != 0 { 1 } else { 0 };
 
     if blocks == 0 {
         match prompt_fn(shell) {
diff --git a/src/lib/shell/binary/readln.rs b/src/lib/shell/binary/readln.rs
index b7a78da18c3bbf80ec49e68b914e26a0974a1505..29f0c24ce3ab9d7299f6d2582b514c0cdd2a1114 100644
--- a/src/lib/shell/binary/readln.rs
+++ b/src/lib/shell/binary/readln.rs
@@ -1,11 +1,6 @@
 use super::super::{completer::*, Binary, DirectoryStack, Shell, Variables};
 use liner::{BasicCompleter, CursorPosition, Event, EventKind};
-use std::{
-    env,
-    io::ErrorKind,
-    mem,
-    path::PathBuf,
-};
+use std::{env, io::ErrorKind, mem, path::PathBuf};
 use sys;
 use types;
 
@@ -15,11 +10,17 @@ pub(crate) fn readln(shell: &mut Shell) -> Option<String> {
         let dirs_ptr = &shell.directory_stack as *const DirectoryStack;
 
         // Collects the current list of values from history for completion.
-        let history = shell.context.as_ref().unwrap().history.buffers.iter()
-                // Map each underlying `liner::Buffer` into a `String`.
-                .map(|x| x.chars().cloned().collect())
-                // Collect each result into a vector to avoid borrowing issues.
-                .collect::<Vec<types::Str>>();
+        let history = shell
+            .context
+            .as_ref()
+            .unwrap()
+            .history
+            .buffers
+            .iter()
+            // Map each underlying `liner::Buffer` into a `String`.
+            .map(|x| x.chars().cloned().collect())
+            // Collect each result into a vector to avoid borrowing issues.
+            .collect::<Vec<types::Str>>();
 
         {
             let prompt = shell.prompt();
@@ -64,17 +65,21 @@ pub(crate) fn readln(shell: &mut Shell) -> Option<String> {
                             // Creates a list of definitions from the shell environment that
                             // will be used
                             // in the creation of a custom completer.
-                            let words = builtins.keys().iter()
+                            let words = builtins
+                                .keys()
+                                .iter()
                                 // Add built-in commands to the completer's definitions.
                                 .map(|&s| s.to_string())
                                 // Add the history list to the completer's definitions.
                                 .chain(history.iter().map(|s| s.to_string()))
                                 // Add the aliases to the completer's definitions.
                                 .chain(vars.aliases().map(|(key, _)| key.to_string()))
-                                // Add the list of available functions to the completer's definitions.
+                                // Add the list of available functions to the completer's
+                                // definitions.
                                 .chain(vars.functions().map(|(key, _)| key.to_string()))
-                                // Add the list of available variables to the completer's definitions.
-                                // TODO: We should make it free to do String->SmallString
+                                // Add the list of available variables to the completer's
+                                // definitions. TODO: We should make
+                                // it free to do String->SmallString
                                 //       and mostly free to go back (free if allocated)
                                 .chain(vars.string_vars().map(|(s, _)| ["$", &s].concat()))
                                 .collect();
diff --git a/src/lib/shell/binary/terminate.rs b/src/lib/shell/binary/terminate.rs
index e231c4a6828e8857ee7299fffae484985d6e7858..6e5272538c9ccd5b9a0469cbd388ec3cffca8493 100644
--- a/src/lib/shell/binary/terminate.rs
+++ b/src/lib/shell/binary/terminate.rs
@@ -1,5 +1,5 @@
-use shell::{flags::UNTERMINATED, status::*, Binary, FlowLogic, Shell};
 use parser::Terminator;
+use shell::{flags::UNTERMINATED, status::*, Binary, FlowLogic, Shell};
 
 pub(crate) fn terminate_script_quotes<I: Iterator<Item = String>>(
     shell: &mut Shell,
@@ -8,30 +8,11 @@ pub(crate) fn terminate_script_quotes<I: Iterator<Item = String>>(
     while let Some(command) = lines.next() {
         let mut buffer = Terminator::new(command);
         while !buffer.is_terminated() {
-            loop {
-                if let Some(command) = lines.next() {
-                    if !command.starts_with('#') {
-                        let mut start = 0;
-                        let cmd: &str = loop {
-                            if start >= command.len() {
-                                break &command;
-                            }
-
-                            match command[start..].find('#').map(|x| x + start) {
-                                Some(pos) if command.as_bytes()[pos - 1] != b' ' => {
-                                    start = pos + 1;
-                                }
-                                Some(pos) => break &command[..pos],
-                                None => break &command,
-                            }
-                        };
-                        buffer.append(cmd);
-                        break;
-                    }
-                } else {
-                    eprintln!("ion: unterminated quote in script");
-                    return FAILURE;
-                }
+            if let Some(command) = lines.find(|cmd| !cmd.starts_with('#')) {
+                buffer.append(command.split(" #").next().unwrap_or(&command));
+            } else {
+                eprintln!("ion: unterminated quote in script");
+                return FAILURE;
             }
         }
         shell.on_command(&buffer.consume());
@@ -39,10 +20,7 @@ pub(crate) fn terminate_script_quotes<I: Iterator<Item = String>>(
 
     if shell.flow_control.unclosed_block() {
         let open_block = shell.flow_control.block.last().unwrap();
-        eprintln!(
-            "ion: unexpected end of script: expected end block for `{}`",
-            open_block.short(),
-        );
+        eprintln!("ion: unexpected end of script: expected end block for `{}`", open_block.short(),);
         return FAILURE;
     }
 
@@ -52,9 +30,9 @@ pub(crate) fn terminate_script_quotes<I: Iterator<Item = String>>(
 pub(crate) fn terminate_quotes(shell: &mut Shell, command: String) -> Result<String, ()> {
     let mut buffer = Terminator::new(command);
     shell.flags |= UNTERMINATED;
-    while ! buffer.is_terminated() {
+    while !buffer.is_terminated() {
         if let Some(command) = shell.readln() {
-            if ! command.starts_with('#') {
+            if !command.starts_with('#') {
                 buffer.append(&command);
             }
         } else {
diff --git a/src/lib/shell/colors.rs b/src/lib/shell/colors.rs
index eb1f53d491fa00729e75373e327f290cd7806656..f7cde1c9427f4ec6325e88a460e3ee8f0ff819fa 100644
--- a/src/lib/shell/colors.rs
+++ b/src/lib/shell/colors.rs
@@ -6,10 +6,7 @@ struct StaticMap {
 
 impl StaticMap {
     fn get(&self, key: &str) -> Option<&'static str> {
-        self.keys
-            .binary_search(&key)
-            .ok()
-            .map(|pos| unsafe { *self.values.get_unchecked(pos) })
+        self.keys.binary_search(&key).ok().map(|pos| unsafe { *self.values.get_unchecked(pos) })
     }
 }
 
@@ -145,10 +142,12 @@ impl Colors {
 
             match variable.len() {
                 // 256 colors: 0xF | 0xFF
-                1 | 2 => if let Ok(value) = u8::from_str_radix(variable, 16) {
-                    *field = Some(Mode::Range256(value));
-                    return true;
-                },
+                1 | 2 => {
+                    if let Ok(value) = u8::from_str_radix(variable, 16) {
+                        *field = Some(Mode::Range256(value));
+                        return true;
+                    }
+                }
                 // 24-bit Color 0xRGB
                 3 => {
                     let mut chars = variable.chars();
@@ -162,14 +161,16 @@ impl Colors {
                     }
                 }
                 // 24-bit Color 0xRRGGBB
-                6 => if let Ok(red) = u8::from_str_radix(&variable[0..2], 16) {
-                    if let Ok(green) = u8::from_str_radix(&variable[2..4], 16) {
-                        if let Ok(blue) = u8::from_str_radix(&variable[4..6], 16) {
-                            *field = Some(Mode::TrueColor(red, green, blue));
-                            return true;
+                6 => {
+                    if let Ok(red) = u8::from_str_radix(&variable[0..2], 16) {
+                        if let Ok(green) = u8::from_str_radix(&variable[2..4], 16) {
+                            if let Ok(blue) = u8::from_str_radix(&variable[4..6], 16) {
+                                *field = Some(Mode::TrueColor(red, green, blue));
+                                return true;
+                            }
                         }
                     }
-                },
+                }
                 _ => (),
             }
         } else if let Ok(value) = variable.parse::<u8>() {
@@ -200,18 +201,10 @@ impl Colors {
     /// transformation into ANSI code parameters, which may be obtained by calling the
     /// `into_string()` method on the newly-created `Colors` structure.
     pub(crate) fn collect(input: &str) -> Colors {
-        let mut colors = Colors {
-            foreground: None,
-            background: None,
-            attributes: None,
-        };
+        let mut colors = Colors { foreground: None, background: None, attributes: None };
         for variable in input.split(',') {
             if variable == "reset" {
-                return Colors {
-                    foreground: None,
-                    background: None,
-                    attributes: Some(vec!["0"]),
-                };
+                return Colors { foreground: None, background: None, attributes: Some(vec!["0"]) };
             } else if let Some(attribute) = ATTRIBUTES.get(&variable) {
                 colors.append_attribute(attribute);
             } else if let Some(color) = COLORS.get(&variable) {
@@ -255,11 +248,8 @@ mod test {
 
     #[test]
     fn set_multiple_color_attributes() {
-        let expected = Colors {
-            attributes: Some(vec!["1", "4", "5"]),
-            background: None,
-            foreground: None,
-        };
+        let expected =
+            Colors { attributes: Some(vec!["1", "4", "5"]), background: None, foreground: None };
         let actual = Colors::collect("bold,underlined,blink");
         assert_eq!(actual, expected);
         assert_eq!(Some("\x1b[1;4;5m".to_owned()), actual.into_string());
@@ -286,10 +276,7 @@ mod test {
         };
         let actual = Colors::collect("0x4b,0x4dbg");
         assert_eq!(actual, expected);
-        assert_eq!(
-            Some("\x1b[38;5;75;48;5;77m".to_owned()),
-            actual.into_string()
-        )
+        assert_eq!(Some("\x1b[38;5;75;48;5;77m".to_owned()), actual.into_string())
     }
 
     #[test]
@@ -301,10 +288,7 @@ mod test {
         };
         let actual = Colors::collect("78bg,32");
         assert_eq!(actual, expected);
-        assert_eq!(
-            Some("\x1b[38;5;32;48;5;78m".to_owned()),
-            actual.into_string()
-        )
+        assert_eq!(Some("\x1b[38;5;32;48;5;78m".to_owned()), actual.into_string())
     }
 
     #[test]
@@ -316,10 +300,7 @@ mod test {
         };
         let actual = Colors::collect("0x000,0xFFFbg");
         assert_eq!(expected, actual);
-        assert_eq!(
-            Some("\x1b[38;2;0;0;0;48;2;255;255;255m".to_owned()),
-            actual.into_string()
-        );
+        assert_eq!(Some("\x1b[38;2;0;0;0;48;2;255;255;255m".to_owned()), actual.into_string());
     }
 
     #[test]
diff --git a/src/lib/shell/completer.rs b/src/lib/shell/completer.rs
index c2bf3a93c6f3ade75fc63c11c3abbab86085c343..ea4cee2179272346253b07eaef27eadd7012f1d7 100644
--- a/src/lib/shell/completer.rs
+++ b/src/lib/shell/completer.rs
@@ -26,11 +26,7 @@ impl IonFileCompleter {
         dir_stack: *const DirectoryStack,
         vars: *const Variables,
     ) -> IonFileCompleter {
-        IonFileCompleter {
-            inner: FilenameCompleter::new(path),
-            dir_stack,
-            vars,
-        }
+        IonFileCompleter { inner: FilenameCompleter::new(path), dir_stack, vars }
     }
 }
 
@@ -137,10 +133,8 @@ where
     let string = unsafe { &str::from_utf8_unchecked(&string) };
 
     let globs = glob(string).ok().and_then(|completions| {
-        let mut completions = completions
-            .filter_map(Result::ok)
-            .map(|x| x.to_string_lossy().into_owned())
-            .peekable();
+        let mut completions =
+            completions.filter_map(Result::ok).map(|x| x.to_string_lossy().into_owned()).peekable();
 
         if completions.peek().is_some() {
             Some(completions)
@@ -156,11 +150,8 @@ where
 
     // Use Liner::Completer as well, to preserve the previous behaviour
     // around single-directory completions
-    iter_inner_glob.flat_map(move |path| {
-        liner_complete(&path)
-            .into_iter()
-            .map(|x| escape(x.as_str()))
-    })
+    iter_inner_glob
+        .flat_map(move |path| liner_complete(&path).into_iter().map(|x| escape(x.as_str())))
 }
 
 /// A completer that combines suggestions from multiple completers.
@@ -211,16 +202,10 @@ mod tests {
             &Variables::default(),
         );
         assert_eq!(completer.completions("testing"), vec!["testing/"]);
-        assert_eq!(
-            completer.completions("testing/file"),
-            vec!["testing/file_with_text"]
-        );
+        assert_eq!(completer.completions("testing/file"), vec!["testing/file_with_text"]);
 
         assert_eq!(completer.completions("~"), vec!["~/"]);
 
-        assert_eq!(
-            completer.completions("tes/fil"),
-            vec!["testing/file_with_text"]
-        );
+        assert_eq!(completer.completions("tes/fil"), vec!["testing/file_with_text"]);
     }
 }
diff --git a/src/lib/shell/directory_stack.rs b/src/lib/shell/directory_stack.rs
index 0f5592298f2a195b4a67de5e221a5e61f755b3be..e64ae506eac21cebeb204b3db1d9966ff4296f44 100644
--- a/src/lib/shell/directory_stack.rs
+++ b/src/lib/shell/directory_stack.rs
@@ -76,10 +76,7 @@ impl DirectoryStack {
         caller: &str,
     ) -> Result<(), Cow<'static, str>> {
         let dir = self.dirs.get(index).ok_or_else(|| {
-            Cow::Owned(format!(
-                "ion: {}: {}: directory stack out of range",
-                caller, index
-            ))
+            Cow::Owned(format!("ion: {}: {}: directory stack out of range", caller, index))
         })?;
 
         set_current_dir_ion(dir)
@@ -134,16 +131,16 @@ impl DirectoryStack {
             self.dirs.truncate(1);
         }
 
-        let mapper: fn((usize, &PathBuf)) -> Cow<str> = match (
-            dirs_args & ABS_PATHNAMES > 0,
-            dirs_args & INDEX > 0,
-        ) {
-            // ABS, INDEX
-            (true, true) => |(num, x)| Cow::Owned(format!(" {}  {}", num, try_abs_path(x))),
-            (true, false) => |(_, x)| try_abs_path(x),
-            (false, true) => |(num, x)| Cow::Owned(format!(" {}  {}", num, x.to_string_lossy())),
-            (false, false) => |(_, x)| x.to_string_lossy(),
-        };
+        let mapper: fn((usize, &PathBuf)) -> Cow<str> =
+            match (dirs_args & ABS_PATHNAMES > 0, dirs_args & INDEX > 0) {
+                // ABS, INDEX
+                (true, true) => |(num, x)| Cow::Owned(format!(" {}  {}", num, try_abs_path(x))),
+                (true, false) => |(_, x)| try_abs_path(x),
+                (false, true) => {
+                    |(num, x)| Cow::Owned(format!(" {}  {}", num, x.to_string_lossy()))
+                }
+                (false, false) => |(_, x)| x.to_string_lossy(),
+            };
 
         let mut iter = self.dirs.iter().enumerate().map(mapper);
 
@@ -153,11 +150,8 @@ impl DirectoryStack {
                 None => return FAILURE,
             };
         } else {
-            let folder: fn(String, Cow<str>) -> String = if dirs_args & MULTILINE > 0 {
-                |x, y| x + "\n" + &y
-            } else {
-                |x, y| x + " " + &y
-            };
+            let folder: fn(String, Cow<str>) -> String =
+                if dirs_args & MULTILINE > 0 { |x, y| x + "\n" + &y } else { |x, y| x + " " + &y };
 
             let first = match iter.next() {
                 Some(x) => x.to_string(),
@@ -228,9 +222,7 @@ impl DirectoryStack {
             Err(Cow::Borrowed("ion: failed to get home directory")),
             |home| {
                 home.to_str().map_or(
-                    Err(Cow::Borrowed(
-                        "ion: failed to convert home directory to str",
-                    )),
+                    Err(Cow::Borrowed("ion: failed to convert home directory to str")),
                     |home| self.change_and_push_dir(home, variables),
                 )
             },
@@ -305,14 +297,18 @@ impl DirectoryStack {
                     self.dirs.swap(0, 1);
                 }
             }
-            Action::RotLeft(num) => if !keep_front {
-                self.set_current_dir_by_index(num, "pushd")?;
-                self.rotate_left(num);
-            },
-            Action::RotRight(num) => if !keep_front {
-                self.set_current_dir_by_index(len - (num % len), "pushd")?;
-                self.rotate_right(num);
-            },
+            Action::RotLeft(num) => {
+                if !keep_front {
+                    self.set_current_dir_by_index(num, "pushd")?;
+                    self.rotate_left(num);
+                }
+            }
+            Action::RotRight(num) => {
+                if !keep_front {
+                    self.set_current_dir_by_index(len - (num % len), "pushd")?;
+                    self.rotate_right(num);
+                }
+            }
             Action::Push(dir) => {
                 let index = if keep_front { 1 } else { 0 };
                 let new_dir = self.normalize_path(dir.to_str().unwrap());
@@ -391,10 +387,7 @@ impl DirectoryStack {
     /// variable,
     /// else it will return a default value of 1000.
     fn get_size(variables: &Variables) -> usize {
-        variables
-            .get_str_or_empty("DIRECTORY_STACK_SIZE")
-            .parse::<usize>()
-            .unwrap_or(1000)
+        variables.get_str_or_empty("DIRECTORY_STACK_SIZE").parse::<usize>().unwrap_or(1000)
     }
 
     /// Create a new `DirectoryStack` containing the current working directory,
@@ -423,15 +416,11 @@ fn parse_numeric_arg(arg: &str) -> Option<(bool, usize)> {
         Some('+') => Some(true),
         Some('-') => Some(false),
         _ => None,
-    }.and_then(|b| arg[1..].parse::<usize>().ok().map(|num| (b, num)))
+    }
+    .and_then(|b| arg[1..].parse::<usize>().ok().map(|num| (b, num)))
 }
 
 // converts pbuf to an absolute path if possible
 fn try_abs_path(pbuf: &PathBuf) -> Cow<str> {
-    Cow::Owned(
-        pbuf.canonicalize()
-            .unwrap_or_else(|_| pbuf.clone())
-            .to_string_lossy()
-            .to_string(),
-    )
+    Cow::Owned(pbuf.canonicalize().unwrap_or_else(|_| pbuf.clone()).to_string_lossy().to_string())
 }
diff --git a/src/lib/shell/flow.rs b/src/lib/shell/flow.rs
index 8ffe9e37bf5954dd1193dc6bfe86da52e13e9e34..b9d0c4de35d1f4feaa82f6db52b2291bc640b920 100644
--- a/src/lib/shell/flow.rs
+++ b/src/lib/shell/flow.rs
@@ -1,4 +1,3 @@
-use itertools::Itertools;
 use super::{
     flags::*,
     flow_control::{insert_statement, Case, ElseIf, Function, Statement},
@@ -6,6 +5,7 @@ use super::{
     status::*,
     Shell,
 };
+use itertools::Itertools;
 use parser::{
     assignments::is_array,
     expand_string, parse_and_validate,
@@ -18,13 +18,13 @@ use std::io::{stdout, Write};
 use types;
 
 macro_rules! handle_signal {
-    ($signal:expr) => (
+    ($signal:expr) => {
         match $signal {
             Condition::Break => break,
             Condition::SigInt => return Condition::SigInt,
             _ => (),
         }
-    )
+    };
 }
 
 #[derive(Debug)]
@@ -94,9 +94,7 @@ impl FlowLogic for Shell {
         }
 
         // Try to execute else_if branches
-        let else_if_conditions = else_if
-            .into_iter()
-            .map(|cond| (cond.expression, cond.success));
+        let else_if_conditions = else_if.into_iter().map(|cond| (cond.expression, cond.success));
 
         for (condition, statements) in else_if_conditions {
             if let Condition::SigInt = self.execute_statements(condition) {
@@ -118,7 +116,7 @@ impl FlowLogic for Shell {
         statements: Vec<Statement>,
     ) -> Condition {
         macro_rules! set_vars_then_exec {
-            ($chunk:expr, $def:expr) => (
+            ($chunk:expr, $def:expr) => {
                 for (key, value) in variables.iter().zip($chunk.chain(::std::iter::repeat($def))) {
                     if key != "_" {
                         self.set(key, value.clone());
@@ -126,21 +124,27 @@ impl FlowLogic for Shell {
                 }
 
                 handle_signal!(self.execute_statements(statements.clone()));
-            )
+            };
         }
 
         let default = ::small::String::new();
 
         match ForValueExpression::new(values, self) {
-            ForValueExpression::Multiple(values) => for chunk in &values.iter().chunks(variables.len()) {
-                set_vars_then_exec!(chunk, &default);
-            },
-            ForValueExpression::Normal(values) => for chunk in &values.lines().chunks(variables.len()) {
-                set_vars_then_exec!(chunk, "");
-            },
-            ForValueExpression::Range(range) => for chunk in &range.chunks(variables.len()) {
-                set_vars_then_exec!(chunk, default.clone());
-            },
+            ForValueExpression::Multiple(values) => {
+                for chunk in &values.iter().chunks(variables.len()) {
+                    set_vars_then_exec!(chunk, &default);
+                }
+            }
+            ForValueExpression::Normal(values) => {
+                for chunk in &values.lines().chunks(variables.len()) {
+                    set_vars_then_exec!(chunk, "");
+                }
+            }
+            ForValueExpression::Range(range) => {
+                for chunk in &range.chunks(variables.len()) {
+                    set_vars_then_exec!(chunk, default.clone());
+                }
+            }
         };
 
         Condition::NoOp
@@ -185,45 +189,27 @@ impl FlowLogic for Shell {
                 self.previous_status = self.export(action);
                 self.variables.set("?", self.previous_status.to_string());
             }
-            Statement::While {
-                expression,
-                statements,
-            } => {
+            Statement::While { expression, statements } => {
                 if let Condition::SigInt = self.execute_while(expression, statements) {
                     return Condition::SigInt;
                 }
             }
-            Statement::For {
-                variables,
-                values,
-                statements,
-            } => {
+            Statement::For { variables, values, statements } => {
                 if let Condition::SigInt = self.execute_for(&variables, &values, statements) {
                     return Condition::SigInt;
                 }
             }
-            Statement::If {
-                expression,
-                success,
-                else_if,
-                failure,
-                ..
-            } => match self.execute_if(expression, success, else_if, failure) {
-                Condition::Break => return Condition::Break,
-                Condition::Continue => return Condition::Continue,
-                Condition::NoOp => (),
-                Condition::SigInt => return Condition::SigInt,
-            },
-            Statement::Function {
-                name,
-                args,
-                statements,
-                description,
-            } => {
-                self.variables.set(
-                    &name,
-                    Function::new(description, name.clone(), args, statements),
-                );
+            Statement::If { expression, success, else_if, failure, .. } => {
+                match self.execute_if(expression, success, else_if, failure) {
+                    Condition::Break => return Condition::Break,
+                    Condition::Continue => return Condition::Continue,
+                    Condition::NoOp => (),
+                    Condition::SigInt => return Condition::SigInt,
+                }
+            }
+            Statement::Function { name, args, statements, description } => {
+                self.variables
+                    .set(&name, Function::new(description, name.clone(), args, statements));
             }
             Statement::Pipeline(pipeline) => match expand_pipeline(&self, pipeline) {
                 Ok((mut pipeline, statements)) => {
@@ -380,16 +366,12 @@ impl FlowLogic for Shell {
                     let mut previous_bind = None;
                     if let Some(ref bind) = case.binding {
                         if is_array {
-                            previous_bind = self
-                                .variables
-                                .get::<types::Array>(bind)
-                                .map(VariableType::Array);
+                            previous_bind =
+                                self.variables.get::<types::Array>(bind).map(VariableType::Array);
                             self.variables.set(&bind, value.clone());
                         } else {
-                            previous_bind = self
-                                .variables
-                                .get::<types::Str>(bind)
-                                .map(VariableType::Str);
+                            previous_bind =
+                                self.variables.get::<types::Str>(bind).map(VariableType::Str);
                             self.set(&bind, value.join(" "));
                         }
                     }
@@ -426,16 +408,12 @@ impl FlowLogic for Shell {
                     let mut previous_bind = None;
                     if let Some(ref bind) = case.binding {
                         if is_array {
-                            previous_bind = self
-                                .variables
-                                .get::<types::Array>(bind)
-                                .map(VariableType::Array);
+                            previous_bind =
+                                self.variables.get::<types::Array>(bind).map(VariableType::Array);
                             self.variables.set(&bind, value.clone());
                         } else {
-                            previous_bind = self
-                                .variables
-                                .get::<types::Str>(bind)
-                                .map(VariableType::Str);
+                            previous_bind =
+                                self.variables.get::<types::Str>(bind).map(VariableType::Str);
                             self.set(&bind, value.join(" "));
                         }
                     }
@@ -508,13 +486,9 @@ fn expand_pipeline(
     let mut statements = Vec::new();
 
     while let Some(item) = item_iter.next() {
-        let possible_alias = shell
-            .variables
-            .get::<types::Alias>(item.job.command.as_ref());
+        let possible_alias = shell.variables.get::<types::Alias>(item.job.command.as_ref());
         if let Some(alias) = possible_alias {
-            statements = StatementSplitter::new(alias.0.as_str())
-                .map(parse_and_validate)
-                .collect();
+            statements = StatementSplitter::new(alias.0.as_str()).map(parse_and_validate).collect();
 
             // First item in the alias should be a pipeline item, otherwise it cannot
             // be placed into a pipeline!
@@ -548,7 +522,7 @@ fn expand_pipeline(
             statements.remove(0);
 
             // Handle pipeline being broken half by i.e.: '&&' or '||'
-            if ! statements.is_empty() {
+            if !statements.is_empty() {
                 let err = match statements.last_mut().unwrap() {
                     Statement::And(ref mut boxed_stm)
                     | Statement::Or(ref mut boxed_stm)
@@ -563,7 +537,7 @@ fn expand_pipeline(
                             }
                             // Append rest of the pipeline to the last pipeline in the
                             // alias.
-                            while let Some(item) = item_iter.next() {
+                            for item in item_iter {
                                 pline.items.push(item.clone());
                             }
                             // No error
diff --git a/src/lib/shell/flow_control.rs b/src/lib/shell/flow_control.rs
index 7157315d1285989b4e380df23cfc8fbbc7b86c89..e114555c65f85f65f15f400036ef987c3ce805d5 100644
--- a/src/lib/shell/flow_control.rs
+++ b/src/lib/shell/flow_control.rs
@@ -131,6 +131,7 @@ impl Statement {
             Statement::Default => "Default",
         }
     }
+
     pub fn is_block(&self) -> bool {
         match *self {
             Statement::Case(_)
@@ -156,15 +157,11 @@ impl FlowControl {
     pub(crate) fn reset(&mut self) { self.block.clear() }
 
     /// Check if there isn't an unfinished block.
-    pub(crate) fn unclosed_block(&self) -> bool { ! self.block.is_empty() }
+    pub(crate) fn unclosed_block(&self) -> bool { !self.block.is_empty() }
 }
 
 impl Default for FlowControl {
-    fn default() -> FlowControl {
-        FlowControl {
-            block: Vec::with_capacity(5),
-        }
-    }
+    fn default() -> FlowControl { FlowControl { block: Vec::with_capacity(5) } }
 }
 
 pub(crate) fn insert_statement(
@@ -206,7 +203,7 @@ pub(crate) fn insert_statement(
                             // Merge last Case back and pop off Match too
                             insert_into_block(&mut flow_control.block, block)?;
                             let match_stm = flow_control.block.pop().unwrap();
-                            if ! flow_control.block.is_empty() {
+                            if !flow_control.block.is_empty() {
                                 insert_into_block(&mut flow_control.block, match_stm)?;
                             } else {
                                 return Ok(Some(match_stm));
@@ -217,7 +214,7 @@ pub(crate) fn insert_statement(
                 }
             }
         }
-        Statement::And(_) | Statement::Or(_) if ! flow_control.block.is_empty() => {
+        Statement::And(_) | Statement::Or(_) if !flow_control.block.is_empty() => {
             let mut pushed = true;
             if let Some(top) = flow_control.block.last_mut() {
                 match top {
@@ -248,14 +245,13 @@ pub(crate) fn insert_statement(
                         }
                         _ => pushed = false,
                     },
-                    Statement::While {
-                        ref mut expression,
-                        ref statements,
-                    } => if statements.is_empty() {
-                        expression.push(statement.clone());
-                    } else {
-                        pushed = false;
-                    },
+                    Statement::While { ref mut expression, ref statements } => {
+                        if statements.is_empty() {
+                            expression.push(statement.clone());
+                        } else {
+                            pushed = false;
+                        }
+                    }
                     _ => pushed = false,
                 }
             } else {
@@ -269,25 +265,29 @@ pub(crate) fn insert_statement(
             if inner.is_block() {
                 flow_control.block.push(Statement::Time(inner));
             } else {
-                return Ok(Some(Statement::Time(inner)))
+                return Ok(Some(Statement::Time(inner)));
             }
         }
-        _ => if ! flow_control.block.is_empty() {
-            insert_into_block(&mut flow_control.block, statement)?;
-        } else {
-            // Filter out toplevel statements that should produce an error
-            // otherwise return the statement for immediat execution
-            match statement {
-                Statement::ElseIf(_) => {
-                    return Err("ion: error: found ElseIf { .. } without If { .. } block")
+        _ => {
+            if !flow_control.block.is_empty() {
+                insert_into_block(&mut flow_control.block, statement)?;
+            } else {
+                // Filter out toplevel statements that should produce an error
+                // otherwise return the statement for immediat execution
+                match statement {
+                    Statement::ElseIf(_) => {
+                        return Err("ion: error: found ElseIf { .. } without If { .. } block");
+                    }
+                    Statement::Else => return Err("ion: error: found Else without If { .. } block"),
+                    Statement::Break => return Err("ion: error: found Break without loop body"),
+                    Statement::Continue => {
+                        return Err("ion: error: found Continue without loop body");
+                    }
+                    // Toplevel statement, return to execute immediately
+                    _ => return Ok(Some(statement)),
                 }
-                Statement::Else => return Err("ion: error: found Else without If { .. } block"),
-                Statement::Break => return Err("ion: error: found Break without loop body"),
-                Statement::Continue => return Err("ion: error: found Continue without loop body"),
-                // Toplevel statement, return to execute immediately
-                _ => return Ok(Some(statement)),
             }
-        },
+        }
     }
     Ok(None)
 }
@@ -300,20 +300,14 @@ fn insert_into_block(block: &mut Vec<Statement>, statement: Statement) -> Result
         };
 
         match block {
-            Statement::Function {
-                ref mut statements, ..
-            } => statements.push(statement),
-            Statement::For {
-                ref mut statements, ..
-            } => statements.push(statement),
-            Statement::While {
-                ref mut statements, ..
-            } => statements.push(statement),
+            Statement::Function { ref mut statements, .. } => statements.push(statement),
+            Statement::For { ref mut statements, .. } => statements.push(statement),
+            Statement::While { ref mut statements, .. } => statements.push(statement),
             Statement::Match { ref mut cases, .. } => match statement {
                 Statement::Case(case) => cases.push(case),
                 _ => {
                     return Err(
-                        "ion: error: statement found outside of Case { .. } block in Match { .. }",
+                        "ion: error: statement found outside of Case { .. } block in Match { .. }"
                     );
                 }
             },
@@ -325,17 +319,21 @@ fn insert_into_block(block: &mut Vec<Statement>, statement: Statement) -> Result
                 ref mut mode,
                 ..
             } => match statement {
-                Statement::ElseIf(eif) => if *mode > 1 {
-                    return Err("ion: error: ElseIf { .. } found after Else");
-                } else {
-                    *mode = 1;
-                    else_if.push(eif);
-                },
-                Statement::Else => if *mode == 2 {
-                    return Err("ion: error: Else block already exists");
-                } else {
-                    *mode = 2;
-                },
+                Statement::ElseIf(eif) => {
+                    if *mode > 1 {
+                        return Err("ion: error: ElseIf { .. } found after Else");
+                    } else {
+                        *mode = 1;
+                        else_if.push(eif);
+                    }
+                }
+                Statement::Else => {
+                    if *mode == 2 {
+                        return Err("ion: error: Else block already exists");
+                    } else {
+                        *mode = 2;
+                    }
+                }
                 _ => match *mode {
                     0 => success.push(statement),
                     1 => else_if.last_mut().unwrap().success.push(statement),
@@ -398,7 +396,7 @@ impl Function {
                     return Err(FunctionError::InvalidArgumentType(
                         type_.kind.clone(),
                         value.as_ref().into(),
-                    ))
+                    ));
                 }
             };
 
@@ -426,9 +424,7 @@ impl Function {
         Ok(())
     }
 
-    pub(crate) fn get_description(&self) -> Option<&small::String> {
-        self.description.as_ref()
-    }
+    pub(crate) fn get_description(&self) -> Option<&small::String> { self.description.as_ref() }
 
     pub(crate) fn new(
         description: Option<small::String>,
@@ -436,12 +432,7 @@ impl Function {
         args: Vec<KeyBuf>,
         statements: Vec<Statement>,
     ) -> Function {
-        Function {
-            description,
-            name,
-            args,
-            statements,
-        }
+        Function { description, name, args, statements }
     }
 }
 
@@ -450,10 +441,7 @@ mod tests {
     use super::*;
 
     fn new_match() -> Statement {
-        Statement::Match {
-            expression: small::String::from(""),
-            cases:      Vec::new(),
-        }
+        Statement::Match { expression: small::String::from(""), cases: Vec::new() }
     }
     fn new_if() -> Statement {
         Statement::If {
@@ -541,12 +529,7 @@ mod tests {
             assert_eq!(Ok(Some(ok)), res);
         }
 
-        let errs = vec![
-            Statement::Else,
-            Statement::End,
-            Statement::Break,
-            Statement::Continue,
-        ];
+        let errs = vec![Statement::Else, Statement::End, Statement::Break, Statement::Continue];
         for err in errs {
             let res = insert_statement(&mut flow_control, err);
             if res.is_ok() {
diff --git a/src/lib/shell/history.rs b/src/lib/shell/history.rs
index 8d50ff0e1b03473cf7d25e3a40276d63c166e8a8..7f39d003f70c86fff2156d7e9edd2f12ce7f8dff 100644
--- a/src/lib/shell/history.rs
+++ b/src/lib/shell/history.rs
@@ -2,9 +2,11 @@ use shell::{status::*, Shell};
 
 use regex::Regex;
 use small;
-use std::io::{self, Write};
+use std::{
+    io::{self, Write},
+    time::{SystemTime, UNIX_EPOCH},
+};
 use types;
-use std::time::{SystemTime, UNIX_EPOCH};
 
 bitflags! {
     struct IgnoreFlags: u8 {
@@ -31,10 +33,7 @@ pub(crate) struct IgnoreSetting {
 
 impl IgnoreSetting {
     pub(crate) fn default() -> IgnoreSetting {
-        IgnoreSetting {
-            flags:   IgnoreFlags::empty(),
-            regexes: None,
-        }
+        IgnoreSetting { flags: IgnoreFlags::empty(), regexes: None }
     }
 }
 
@@ -85,41 +84,25 @@ impl ShellHistory for Shell {
         }
 
         self.ignore_setting.flags = flags;
-        self.ignore_setting.regexes = if !regexes.is_empty() {
-            Some(regexes)
-        } else {
-            None
-        }
+        self.ignore_setting.regexes = if !regexes.is_empty() { Some(regexes) } else { None }
     }
 
     fn save_command_in_history(&mut self, command: &str) {
         if self.should_save_command(command) {
             if self.variables.get_str_or_empty("HISTORY_TIMESTAMP") == "1" {
                 // Get current time stamp
-                let since_unix_epoch = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs();
+                let since_unix_epoch =
+                    SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs();
                 let cur_time_sys = ["#", &since_unix_epoch.to_owned().to_string()].concat();
 
                 // Push current time to history
-            	if let Err(err) = self
-                    .context
-                    .as_mut()
-                    .unwrap()
-                    .history
-                    .push(cur_time_sys.into())
-            	{
+                if let Err(err) = self.context.as_mut().unwrap().history.push(cur_time_sys.into()) {
                     eprintln!("ion: {}", err)
-            	}
+                }
             }
 
-
             // Push command itself to history
-            if let Err(err) = self
-                .context
-                .as_mut()
-                .unwrap()
-                .history
-                .push(command.into())
-            {
+            if let Err(err) = self.context.as_mut().unwrap().history.push(command.into()) {
                 eprintln!("ion: {}", err);
             }
         }
diff --git a/src/lib/shell/job.rs b/src/lib/shell/job.rs
index e609af43b10467c11a2dc00cb0ecde47d567a701..7ba29f7bb3a656a15d64e76742d35188259a7a88 100644
--- a/src/lib/shell/job.rs
+++ b/src/lib/shell/job.rs
@@ -34,12 +34,7 @@ impl Job {
     pub(crate) fn new(args: types::Array, kind: JobKind) -> Self {
         let command = args[0].clone();
         let builtin = BUILTINS.get(command.as_ref()).map(|b| b.main);
-        Job {
-            command,
-            args,
-            kind,
-            builtin,
-        }
+        Job { command, args, kind, builtin }
     }
 }
 
@@ -75,29 +70,18 @@ pub struct RefinedJob {
     pub stdin:  Option<File>,
     pub stdout: Option<File>,
     pub stderr: Option<File>,
-    pub var:    JobVariant
+    pub var:    JobVariant,
 }
 
 pub enum JobVariant {
     /// An external program that is executed by this shell
-    External {
-        name: types::Str,
-        args: types::Array
-    },
+    External { name: types::Str, args: types::Array },
     /// A procedure embedded into Ion
-    Builtin {
-        main: BuiltinFunction,
-        args: types::Array,
-    },
+    Builtin { main: BuiltinFunction, args: types::Array },
     /// Functions can act as commands too!
-    Function {
-       name: types::Str,
-       args: types::Array,
-    },
+    Function { name: types::Str, args: types::Array },
     /// Represents redirection into stdin from more than one source
-    Cat {
-        sources: Vec<File>,
-    },
+    Cat { sources: Vec<File> },
     Tee {
         /// 0 for stdout, 1 for stderr
         items: (Option<TeeItem>, Option<TeeItem>),
@@ -201,18 +185,15 @@ impl RefinedJob {
         let stdout = &self.stdout;
         let stderr = &self.stderr;
         match self.var {
-            JobVariant::External {
-                ref name,
-                ref args,
-            } => shell.exec_external(&name, &args[1..], stdin, stdout, stderr),
-            JobVariant::Builtin {
-                main,
-                ref args,
-            } => shell.exec_builtin(main, &**args, stdout, stderr, stdin),
-            JobVariant::Function {
-                ref name,
-                ref args,
-            } => shell.exec_function(name, args, stdout, stderr, stdin),
+            JobVariant::External { ref name, ref args } => {
+                shell.exec_external(&name, &args[1..], stdin, stdout, stderr)
+            }
+            JobVariant::Builtin { main, ref args } => {
+                shell.exec_builtin(main, &**args, stdout, stderr, stdin)
+            }
+            JobVariant::Function { ref name, ref args } => {
+                shell.exec_function(name, args, stdout, stderr, stdin)
+            }
             _ => panic!("exec job should not be able to be called on Cat or Tee jobs"),
         }
     }
@@ -225,32 +206,21 @@ impl RefinedJob {
         self.stderr = Some(file);
     }
 
-    pub(crate) fn stdout(&mut self, file: File) {
-        self.stdout = Some(file);
-    }
+    pub(crate) fn stdout(&mut self, file: File) { self.stdout = Some(file); }
 
-    pub(crate) fn stdin(&mut self, file: File) {
-        self.stdin = Some(file);
-    }
+    pub(crate) fn stdin(&mut self, file: File) { self.stdin = Some(file); }
 
     pub(crate) fn tee(tee_out: Option<TeeItem>, tee_err: Option<TeeItem>) -> Self {
         RefinedJob {
             stdin:  None,
             stdout: None,
             stderr: None,
-            var: JobVariant::Tee {
-                items:  (tee_out, tee_err),
-            }
+            var:    JobVariant::Tee { items: (tee_out, tee_err) },
         }
     }
 
     pub(crate) fn cat(sources: Vec<File>) -> Self {
-        RefinedJob {
-            stdin:  None,
-            stdout: None,
-            stderr: None,
-            var: JobVariant::Cat { sources }
-        }
+        RefinedJob { stdin: None, stdout: None, stderr: None, var: JobVariant::Cat { sources } }
     }
 
     pub(crate) fn function(name: types::Str, args: types::Array) -> Self {
@@ -258,7 +228,7 @@ impl RefinedJob {
             stdin:  None,
             stdout: None,
             stderr: None,
-            var: JobVariant::Function { name, args }
+            var:    JobVariant::Function { name, args },
         }
     }
 
@@ -267,7 +237,7 @@ impl RefinedJob {
             stdin:  None,
             stdout: None,
             stderr: None,
-            var: JobVariant::Builtin { main, args }
+            var:    JobVariant::Builtin { main, args },
         }
     }
 
@@ -276,7 +246,7 @@ impl RefinedJob {
             stdin:  None,
             stdout: None,
             stderr: None,
-            var: JobVariant::External { name, args }
+            var:    JobVariant::External { name, args },
         }
     }
 }
diff --git a/src/lib/shell/mod.rs b/src/lib/shell/mod.rs
index 7a409d23f8367c4b9d4befc64c99dca102642b1b..58b8fdec7be166139031b566fc9a514507b7d460 100644
--- a/src/lib/shell/mod.rs
+++ b/src/lib/shell/mod.rs
@@ -29,25 +29,38 @@ pub mod flags {
 }
 
 pub use self::{
-    binary::Binary, fork::{Capture, Fork, IonResult},
+    binary::Binary,
+    fork::{Capture, Fork, IonResult},
 };
 pub(crate) use self::{
-    flow::FlowLogic, history::{IgnoreSetting, ShellHistory}, job::{Job, JobKind},
+    flow::FlowLogic,
+    history::{IgnoreSetting, ShellHistory},
+    job::{Job, JobKind},
     pipe_exec::{foreground, job_control},
 };
 
 use self::{
-    directory_stack::DirectoryStack, flags::*,
-    flow_control::{FlowControl, Function, FunctionError}, foreground::ForegroundSignals,
-    job_control::{BackgroundProcess, JobControl}, pipe_exec::PipelineExecution, status::*,
+    directory_stack::DirectoryStack,
+    flags::*,
+    flow_control::{FlowControl, Function, FunctionError},
+    foreground::ForegroundSignals,
+    job_control::{BackgroundProcess, JobControl},
+    pipe_exec::PipelineExecution,
+    status::*,
     variables::{VariableType, Variables},
 };
 use builtins::{BuiltinMap, BUILTINS};
 use liner::Context;
 use parser::{pipelines::Pipeline, Expander, MapKeyIter, MapValueIter, Select, Terminator};
 use std::{
-    fs::File, io::{self, Read, Write}, iter::FromIterator, ops::Deref, path::Path, process,
-    sync::{atomic::Ordering, Arc, Mutex}, time::SystemTime,
+    fs::File,
+    io::{self, Read, Write},
+    iter::FromIterator,
+    ops::Deref,
+    path::Path,
+    process,
+    sync::{atomic::Ordering, Arc, Mutex},
+    time::SystemTime,
 };
 use sys;
 use types::{self, Array};
@@ -107,12 +120,13 @@ pub struct Shell {
     ignore_setting: IgnoreSetting,
 }
 
+#[derive(Default)]
 pub struct ShellBuilder;
 
 impl ShellBuilder {
-    pub fn as_binary(self) -> Shell { Shell::new(false) }
+    pub fn as_binary(&self) -> Shell { Shell::new(false) }
 
-    pub fn as_library(self) -> Shell { Shell::new(true) }
+    pub fn as_library(&self) -> Shell { Shell::new(true) }
 
     pub fn set_unique_pid(self) -> ShellBuilder {
         if let Ok(pid) = sys::getpid() {
@@ -185,15 +199,12 @@ impl Shell {
         name: &str,
         args: &[S],
     ) -> Result<i32, IonError> {
-        self.variables
-            .get::<Function>(name)
-            .ok_or(IonError::DoesNotExist)
-            .and_then(|function| {
-                function
-                    .execute(self, args)
-                    .map(|_| self.previous_status)
-                    .map_err(|err| IonError::Function { why: err })
-            })
+        self.variables.get::<Function>(name).ok_or(IonError::DoesNotExist).and_then(|function| {
+            function
+                .execute(self, args)
+                .map(|_| self.previous_status)
+                .map_err(|err| IonError::Function { why: err })
+        })
     }
 
     /// A method for executing scripts in the Ion shell without capturing. Given a `Path`, this
@@ -267,9 +278,8 @@ impl Shell {
                 Some(self.execute_pipeline(pipeline))
             }
         // Branch else if -> input == shell function and set the exit_status
-        } else if let Some(function) = self
-            .variables
-            .get::<Function>(&pipeline.items[0].job.command)
+        } else if let Some(function) =
+            self.variables.get::<Function>(&pipeline.items[0].job.command)
         {
             if !pipeline.requires_piping() {
                 let args = pipeline.items[0].job.args.deref();
@@ -307,12 +317,9 @@ impl Shell {
                         elapsed_time.as_secs(),
                         elapsed_time.subsec_nanos()
                     );
-                    context
-                        .history
-                        .push(summary.into())
-                        .unwrap_or_else(|err| {
-                            eprintln!("ion: history append: {}", err);
-                        });
+                    context.history.push(summary.into()).unwrap_or_else(|err| {
+                        eprintln!("ion: history append: {}", err);
+                    });
                 }
             }
         }
@@ -364,11 +371,7 @@ impl Shell {
                 self.resume_stopped();
                 self.background_send(sys::SIGHUP);
             }
-            self.context
-                .as_mut()
-                .unwrap()
-                .history
-                .commit_to_file();
+            self.context.as_mut().unwrap().history.commit_to_file();
         }
     }
 
@@ -409,9 +412,7 @@ impl<'a> Expander for Shell {
     /// Uses a subshell to expand a given command.
     fn command(&self, command: &str) -> Option<types::Str> {
         let mut output = None;
-        match self.fork(Capture::StdoutThenIgnoreStderr, move |shell| {
-            shell.on_command(command)
-        }) {
+        match self.fork(Capture::StdoutThenIgnoreStderr, move |shell| shell.on_command(command)) {
             Ok(result) => {
                 let mut string = String::with_capacity(1024);
                 match result.stdout.unwrap().read_to_string(&mut string) {
@@ -439,8 +440,7 @@ impl<'a> Expander for Shell {
         } else if quoted {
             self.get::<types::Str>(name)
         } else {
-            self.get::<types::Str>(name)
-                .map(|x| x.ascii_replace('\n', ' '))
+            self.get::<types::Str>(name).map(|x| x.ascii_replace('\n', ' '))
         }
     }
 
@@ -453,20 +453,22 @@ impl<'a> Expander for Shell {
                     return id
                         .resolve(array.len())
                         .and_then(|n| array.get(n))
-                        .map(|x| types::Array::from_iter(Some(x.to_owned())))
+                        .map(|x| types::Array::from_iter(Some(x.to_owned())));
                 }
-                Select::Range(range) => if let Some((start, length)) = range.bounds(array.len()) {
-                    if array.len() > start {
-                        return Some(
-                            array
-                                .iter()
-                                .skip(start)
-                                .take(length)
-                                .map(|x| x.to_owned())
-                                .collect::<types::Array>(),
-                        );
+                Select::Range(range) => {
+                    if let Some((start, length)) = range.bounds(array.len()) {
+                        if array.len() > start {
+                            return Some(
+                                array
+                                    .iter()
+                                    .skip(start)
+                                    .take(length)
+                                    .map(|x| x.to_owned())
+                                    .collect::<types::Array>(),
+                            );
+                        }
                     }
-                },
+                }
                 _ => (),
             }
         } else if let Some(hmap) = self.variables.get::<types::HashMap>(name) {
@@ -494,18 +496,21 @@ impl<'a> Expander for Shell {
                     return Some(array![format!(
                         "{}",
                         hmap.get(&*key).unwrap_or(&VariableType::Str("".into()))
-                    )])
+                    )]);
                 }
                 Select::Index(index) => {
                     use ranges::Index;
                     return Some(array![format!(
                         "{}",
-                        hmap.get(&types::Str::from(match index {
-                            Index::Forward(n) => n as isize,
-                            Index::Backward(n) => -((n+1) as isize)
-                        }.to_string()))
+                        hmap.get(&types::Str::from(
+                            match index {
+                                Index::Forward(n) => n as isize,
+                                Index::Backward(n) => -((n + 1) as isize),
+                            }
+                            .to_string()
+                        ))
                         .unwrap_or(&VariableType::Str("".into()))
-                    )])
+                    )]);
                 }
                 _ => (),
             }
@@ -534,18 +539,21 @@ impl<'a> Expander for Shell {
                     return Some(array![format!(
                         "{}",
                         bmap.get(&*key).unwrap_or(&VariableType::Str("".into()))
-                    )])
+                    )]);
                 }
                 Select::Index(index) => {
                     use ranges::Index;
                     return Some(array![format!(
                         "{}",
-                        bmap.get(&types::Str::from(match index {
-                            Index::Forward(n) => n as isize,
-                            Index::Backward(n) => -((n+1) as isize)
-                        }.to_string()))
+                        bmap.get(&types::Str::from(
+                            match index {
+                                Index::Forward(n) => n as isize,
+                                Index::Backward(n) => -((n + 1) as isize),
+                            }
+                            .to_string()
+                        ))
                         .unwrap_or(&VariableType::Str("".into()))
-                    )])
+                    )]);
                 }
                 _ => (),
             }
@@ -555,27 +563,28 @@ impl<'a> Expander for Shell {
 
     fn map_keys<'b>(&'b self, name: &str, select: Select) -> Option<MapKeyIter<'b>> {
         let nvalues;
-        let map: Box<dyn Iterator<Item = &'b types::Str>> =
-            match self.variables.get_ref(name) {
-                Some(&VariableType::HashMap(ref map)) => {
-                    nvalues = map.len();
-                    Box::new(map.keys())
-                }
-                Some(&VariableType::BTreeMap(ref map)) => {
-                    nvalues = map.len();
-                    Box::new(map.keys())
-                }
-                _ => return None
-            };
+        let map: Box<dyn Iterator<Item = &'b types::Str>> = match self.variables.get_ref(name) {
+            Some(&VariableType::HashMap(ref map)) => {
+                nvalues = map.len();
+                Box::new(map.keys())
+            }
+            Some(&VariableType::BTreeMap(ref map)) => {
+                nvalues = map.len();
+                Box::new(map.keys())
+            }
+            _ => return None,
+        };
 
         match select {
             Select::All => return Some(map),
-            Select::Range(range) => if let Some((start, length)) = range.bounds(nvalues) {
-                if nvalues > start {
-                    return Some(Box::new(map.skip(start).take(length)));
+            Select::Range(range) => {
+                if let Some((start, length)) = range.bounds(nvalues) {
+                    if nvalues > start {
+                        return Some(Box::new(map.skip(start).take(length)));
+                    }
                 }
-            },
-            _ => ()
+            }
+            _ => (),
         }
 
         None
@@ -583,27 +592,28 @@ impl<'a> Expander for Shell {
 
     fn map_values<'b>(&'b self, name: &str, select: Select) -> Option<MapValueIter<'b>> {
         let nvalues;
-        let map: Box<dyn Iterator<Item = types::Str>> =
-            match self.variables.get_ref(name) {
-                Some(&VariableType::HashMap(ref map)) => {
-                    nvalues = map.len();
-                    Box::new(map.values().map(|x| format!("{}", x).into()))
-                }
-                Some(&VariableType::BTreeMap(ref map)) => {
-                    nvalues = map.len();
-                    Box::new(map.values().map(|x| format!("{}", x).into()))
-                }
-                _ => return None
-            };
+        let map: Box<dyn Iterator<Item = types::Str>> = match self.variables.get_ref(name) {
+            Some(&VariableType::HashMap(ref map)) => {
+                nvalues = map.len();
+                Box::new(map.values().map(|x| format!("{}", x).into()))
+            }
+            Some(&VariableType::BTreeMap(ref map)) => {
+                nvalues = map.len();
+                Box::new(map.values().map(|x| format!("{}", x).into()))
+            }
+            _ => return None,
+        };
 
         match select {
             Select::All => return Some(map),
-            Select::Range(range) => if let Some((start, length)) = range.bounds(nvalues) {
-                if nvalues > start {
-                    return Some(Box::new(map.skip(start).take(length)));
+            Select::Range(range) => {
+                if let Some((start, length)) = range.bounds(nvalues) {
+                    if nvalues > start {
+                        return Some(Box::new(map.skip(start).take(length)));
+                    }
                 }
-            },
-            _ => ()
+            }
+            _ => (),
         }
 
         None
diff --git a/src/lib/shell/pipe_exec/foreground.rs b/src/lib/shell/pipe_exec/foreground.rs
index ea7dc969dc6d55efef5d1d392f2d6e9fa3ece830..451b2348bef709f18763ab9357ef746db81a027a 100644
--- a/src/lib/shell/pipe_exec/foreground.rs
+++ b/src/lib/shell/pipe_exec/foreground.rs
@@ -34,9 +34,7 @@ impl ForegroundSignals {
         if reply & ERRORED != 0 {
             Some(BackgroundResult::Errored)
         } else if reply & REPLIED != 0 {
-            Some(BackgroundResult::Status(
-                self.status.load(Ordering::SeqCst) as u8
-            ))
+            Some(BackgroundResult::Status(self.status.load(Ordering::SeqCst) as u8))
         } else {
             None
         }
diff --git a/src/lib/shell/pipe_exec/job_control.rs b/src/lib/shell/pipe_exec/job_control.rs
index 7b8aea40fd3010c4ce71386d6e86e575e3141257..016d9cca445ee2589f3fec583298d6b44a3fd174 100644
--- a/src/lib/shell/pipe_exec/job_control.rs
+++ b/src/lib/shell/pipe_exec/job_control.rs
@@ -59,17 +59,10 @@ pub(crate) fn add_to_background(
     command: String,
 ) -> u32 {
     let mut processes = processes.lock().unwrap();
-    match (*processes)
-        .iter()
-        .position(|x| x.state == ProcessState::Empty)
-    {
+    match (*processes).iter().position(|x| x.state == ProcessState::Empty) {
         Some(id) => {
-            (*processes)[id] = BackgroundProcess {
-                pid,
-                ignore_sighup: false,
-                state,
-                name: command,
-            };
+            (*processes)[id] =
+                BackgroundProcess { pid, ignore_sighup: false, state, name: command };
             id as u32
         }
         None => {
diff --git a/src/lib/shell/pipe_exec/mod.rs b/src/lib/shell/pipe_exec/mod.rs
index 2ea49aecfdc21705fa7f7fe18064bcb4175d6004..8f4a71032001baa9ebf682c22e2c535d87bd0a9d 100644
--- a/src/lib/shell/pipe_exec/mod.rs
+++ b/src/lib/shell/pipe_exec/mod.rs
@@ -8,12 +8,13 @@
 pub mod foreground;
 mod fork;
 pub mod job_control;
-pub mod streams;
 mod pipes;
+pub mod streams;
 
 use self::{
     fork::fork_pipe,
     job_control::{JobControl, ProcessState},
+    pipes::TeePipe,
     streams::{duplicate_streams, redir, redirect_streams},
 };
 use super::{
@@ -38,7 +39,6 @@ use std::{
     process::{self, exit},
 };
 use sys;
-use self::pipes::TeePipe;
 
 type RefinedItem = (RefinedJob, JobKind, Vec<Redirection>, Vec<Input>);
 
@@ -91,9 +91,9 @@ fn is_implicit_cd(argument: &str) -> bool {
 
 /// Insert the multiple redirects as pipelines if necessary. Handle both input and output
 /// redirection if necessary.
-fn do_redirection(piped_commands: SmallVec<[RefinedItem; 16]>)
-    -> Option<SmallVec<[(RefinedJob, JobKind); 16]>>
-{
+fn do_redirection(
+    piped_commands: SmallVec<[RefinedItem; 16]>,
+) -> Option<SmallVec<[(RefinedJob, JobKind); 16]>> {
     let need_tee = |outs: &[_], kind| {
         let (mut stdout_count, mut stderr_count) = (0, 0);
         match kind {
@@ -164,10 +164,7 @@ fn do_redirection(piped_commands: SmallVec<[RefinedItem; 16]>)
 
     macro_rules! set_one_tee {
         ($new:ident, $outputs:ident, $job:ident, $kind:ident, $teed:ident, $other:ident) => {{
-            let mut tee = TeeItem {
-                sinks:  Vec::new(),
-                source: None,
-            };
+            let mut tee = TeeItem { sinks: Vec::new(), source: None };
             for output in $outputs {
                 match if output.append {
                     OpenOptions::new()
@@ -180,11 +177,13 @@ fn do_redirection(piped_commands: SmallVec<[RefinedItem; 16]>)
                 } {
                     Ok(f) => match output.from {
                         RedirectFrom::$teed => tee.sinks.push(f),
-                        RedirectFrom::$other => if RedirectFrom::Stdout == RedirectFrom::$teed {
-                            $job.stderr(f);
-                        } else {
-                            $job.stdout(f);
-                        },
+                        RedirectFrom::$other => {
+                            if RedirectFrom::Stdout == RedirectFrom::$teed {
+                                $job.stderr(f);
+                            } else {
+                                $job.stdout(f);
+                            }
+                        }
                         RedirectFrom::Both => match f.try_clone() {
                             Ok(f_copy) => {
                                 if RedirectFrom::Stdout == RedirectFrom::$teed {
@@ -196,7 +195,8 @@ fn do_redirection(piped_commands: SmallVec<[RefinedItem; 16]>)
                             }
                             Err(e) => {
                                 eprintln!(
-                                    "ion: failed to redirect both stdout and stderr to file '{:?}': {}",
+                                    "ion: failed to redirect both stdout and stderr to file \
+                                     '{:?}': {}",
                                     f, e
                                 );
                                 return None;
@@ -228,10 +228,7 @@ fn do_redirection(piped_commands: SmallVec<[RefinedItem; 16]>)
             (0, _) => {}
             (1, JobKind::Pipe(_)) => {
                 let sources = vec![inputs[0].get_infile()?];
-                new_commands.push((
-                    RefinedJob::cat(sources),
-                    JobKind::Pipe(RedirectFrom::Stdout),
-                ));
+                new_commands.push((RefinedJob::cat(sources), JobKind::Pipe(RedirectFrom::Stdout)));
             }
             (1, _) => job.stdin(inputs[0].get_infile()?),
             _ => {
@@ -243,10 +240,7 @@ fn do_redirection(piped_commands: SmallVec<[RefinedItem; 16]>)
                         return None;
                     });
                 }
-                new_commands.push((
-                    RefinedJob::cat(sources),
-                    JobKind::Pipe(RedirectFrom::Stdout),
-                ));
+                new_commands.push((RefinedJob::cat(sources), JobKind::Pipe(RedirectFrom::Stdout)));
             }
         }
         prev_kind = kind;
@@ -266,14 +260,8 @@ fn do_redirection(piped_commands: SmallVec<[RefinedItem; 16]>)
             (true, false) => set_one_tee!(new_commands, outputs, job, kind, Stdout, Stderr),
             // tee both
             (true, true) => {
-                let mut tee_out = TeeItem {
-                    sinks:  Vec::new(),
-                    source: None,
-                };
-                let mut tee_err = TeeItem {
-                    sinks:  Vec::new(),
-                    source: None,
-                };
+                let mut tee_out = TeeItem { sinks: Vec::new(), source: None };
+                let mut tee_err = TeeItem { sinks: Vec::new(), source: None };
                 for output in outputs {
                     match if output.append {
                         OpenOptions::new()
@@ -359,8 +347,8 @@ pub(crate) trait PipelineExecution {
     /// # Args
     /// * `shell`: A `Shell` that forwards relevant information to the builtin
     /// * `name`: Name of the builtin to execute.
-    /// * `stdin`, `stdout`, `stderr`: File descriptors that will replace the
-    ///    respective standard streams if they are not `None`
+    /// * `stdin`, `stdout`, `stderr`: File descriptors that will replace the respective standard
+    ///   streams if they are not `None`
     /// # Preconditions
     /// * `shell.builtins.contains_key(name)`; otherwise this function will panic
     fn exec_builtin(
@@ -421,21 +409,9 @@ impl PipelineExecution for Shell {
         let result = sys::fork_and_exec(
             name,
             args,
-            if let Some(ref f) = *stdin {
-                Some(f.as_raw_fd())
-            } else {
-                None
-            },
-            if let Some(ref f) = *stdout {
-                Some(f.as_raw_fd())
-            } else {
-                None
-            },
-            if let Some(ref f) = *stderr {
-                Some(f.as_raw_fd())
-            } else {
-                None
-            },
+            if let Some(ref f) = *stdin { Some(f.as_raw_fd()) } else { None },
+            if let Some(ref f) = *stdout { Some(f.as_raw_fd()) } else { None },
+            if let Some(ref f) = *stderr { Some(f.as_raw_fd()) } else { None },
             false,
             || prepare_child(true, 0),
         );
@@ -613,10 +589,7 @@ impl PipelineExecution for Shell {
                 return code;
             }
 
-            eprintln!(
-                "ion: failed to `dup` STDOUT, STDIN, or STDERR: not running '{}'",
-                long
-            );
+            eprintln!("ion: failed to `dup` STDOUT, STDIN, or STDERR: not running '{}'", long);
 
             COULD_NOT_EXEC
         }
@@ -629,11 +602,7 @@ impl PipelineExecution for Shell {
             // This doesn't allocate
             String::new()
         } else {
-            commands
-            .iter()
-            .map(RefinedJob::long)
-            .collect::<Vec<String>>()
-            .join(" | ")
+            commands.iter().map(RefinedJob::long).collect::<Vec<String>>().join(" | ")
         };
 
         // Watch the foreground group, dropping all commands that exit as they exit.
@@ -646,22 +615,14 @@ impl PipelineExecution for Shell {
     ) -> Result<SmallVec<[RefinedItem; 16]>, i32> {
         let mut results: SmallVec<[RefinedItem; 16]> = SmallVec::new();
         for item in pipeline.items.drain(..) {
-            let PipeItem {
-                mut job,
-                outputs,
-                inputs,
-            } = item;
+            let PipeItem { mut job, outputs, inputs } = item;
             let refined = {
                 if is_implicit_cd(&job.args[0]) {
                     RefinedJob::builtin(
                         builtins::builtin_cd,
                         iter::once("cd".into()).chain(job.args.drain()).collect(),
                     )
-                } else if self
-                    .variables
-                    .get::<Function>(job.args[0].as_str())
-                    .is_some()
-                {
+                } else if self.variables.get::<Function>(job.args[0].as_str()).is_some() {
                     RefinedJob::function(job.args[0].clone(), job.args.drain().collect())
                 } else if let Some(builtin) = job.builtin {
                     RefinedJob::builtin(builtin, job.args.drain().collect())
@@ -699,17 +660,12 @@ impl PipelineExecution for Shell {
 
         // If the given pipeline is a background task, fork the shell.
         match possible_background_name {
-            Some((command_name, disown)) =>
-                fork_pipe(
-                    self,
-                    piped_commands,
-                    command_name,
-                    if disown {
-                        ProcessState::Empty
-                    } else {
-                        ProcessState::Running
-                    },
-                ),
+            Some((command_name, disown)) => fork_pipe(
+                self,
+                piped_commands,
+                command_name,
+                if disown { ProcessState::Empty } else { ProcessState::Running },
+            ),
             None => {
                 // While active, the SIGTTOU signal will be ignored.
                 let _sig_ignore = SignalHandler::new();
@@ -738,72 +694,94 @@ pub(crate) fn pipe(
     let mut commands = commands.into_iter().peekable();
     let mut ext_stdio_pipes: Option<Vec<File>> = None;
 
-    loop {
-        if let Some((mut parent, mut kind)) = commands.next() {
-            match kind {
-                JobKind::Pipe(mut mode) => {
-                    // We need to remember the commands as they own the file
-                    // descriptors that are created by sys::pipe.
-                    let remember: SmallVec<[RefinedJob; 16]> = SmallVec::new();
-                    let mut block_child = true;
-                    let (mut pgid, mut last_pid, mut current_pid) = (0, 0, 0);
-
-                    // Append jobs until all piped jobs are running
-                    while let Some((mut child, ckind)) = commands.next() {
-                        // If parent is a RefindJob::External, then we need to keep track of the
-                        // output pipes, so we can properly close them after the job has been
-                        // spawned.
-                        let is_external = if let JobVariant::External { .. } = parent.var {
-                            true
-                        } else {
-                            false
-                        };
-
-                        // TODO: Refactor this part
-                        // If we need to tee both stdout and stderr, we directly connect pipes to
-                        // the relevant sources in both of them.
-                        if let JobVariant::Tee {
-                            items: (Some(ref mut tee_out), Some(ref mut tee_err)),
-                            ..
-                        } = child.var {
-                            TeePipe::new(&mut parent, &mut ext_stdio_pipes, is_external)
-                                .connect(tee_out, tee_err);
-                        } else {
-                            // Pipe the previous command's stdin to this commands stdout/stderr.
-                            match sys::pipe2(sys::O_CLOEXEC) {
-                                Err(e) => pipe_fail(e),
-                                Ok((reader, writer)) => {
-                                    if is_external {
-                                        append_external_stdio_pipe(&mut ext_stdio_pipes, writer);
-                                    }
-                                    child.stdin(unsafe { File::from_raw_fd(reader) });
-                                    let writer = unsafe { File::from_raw_fd(writer) };
-                                    match mode {
-                                        RedirectFrom::Stderr => parent.stderr(writer),
-                                        RedirectFrom::Stdout => parent.stdout(writer),
-                                        RedirectFrom::Both => {
-                                            match writer.try_clone() {
-                                                Err(e) => {
-                                                    eprintln!(
-                                                        "ion: failed to redirect stdout and \
-                                                         stderr: {}",
-                                                        e
-                                                    );
-                                                }
-                                                Ok(duped) => {
-                                                    parent.stderr(writer);
-                                                    parent.stdout(duped);
-                                                }
-                                            }
+    while let Some((mut parent, mut kind)) = commands.next() {
+        match kind {
+            JobKind::Pipe(mut mode) => {
+                // We need to remember the commands as they own the file
+                // descriptors that are created by sys::pipe.
+                let remember: SmallVec<[RefinedJob; 16]> = SmallVec::new();
+                let mut block_child = true;
+                let (mut pgid, mut last_pid, mut current_pid) = (0, 0, 0);
+
+                // Append jobs until all piped jobs are running
+                while let Some((mut child, ckind)) = commands.next() {
+                    // If parent is a RefindJob::External, then we need to keep track of the
+                    // output pipes, so we can properly close them after the job has been
+                    // spawned.
+                    let is_external =
+                        if let JobVariant::External { .. } = parent.var { true } else { false };
+
+                    // TODO: Refactor this part
+                    // If we need to tee both stdout and stderr, we directly connect pipes to
+                    // the relevant sources in both of them.
+                    if let JobVariant::Tee {
+                        items: (Some(ref mut tee_out), Some(ref mut tee_err)),
+                        ..
+                    } = child.var
+                    {
+                        TeePipe::new(&mut parent, &mut ext_stdio_pipes, is_external)
+                            .connect(tee_out, tee_err);
+                    } else {
+                        // Pipe the previous command's stdin to this commands stdout/stderr.
+                        match sys::pipe2(sys::O_CLOEXEC) {
+                            Err(e) => pipe_fail(e),
+                            Ok((reader, writer)) => {
+                                if is_external {
+                                    append_external_stdio_pipe(&mut ext_stdio_pipes, writer);
+                                }
+                                child.stdin(unsafe { File::from_raw_fd(reader) });
+                                let writer = unsafe { File::from_raw_fd(writer) };
+                                match mode {
+                                    RedirectFrom::Stderr => parent.stderr(writer),
+                                    RedirectFrom::Stdout => parent.stdout(writer),
+                                    RedirectFrom::Both => match writer.try_clone() {
+                                        Err(e) => {
+                                            eprintln!(
+                                                "ion: failed to redirect stdout and stderr: {}",
+                                                e
+                                            );
+                                        }
+                                        Ok(duped) => {
+                                            parent.stderr(writer);
+                                            parent.stdout(duped);
                                         }
-                                    }
+                                    },
                                 }
                             }
                         }
+                    }
 
+                    match spawn_proc(
+                        shell,
+                        parent,
+                        kind,
+                        block_child,
+                        &mut last_pid,
+                        &mut current_pid,
+                        pgid,
+                    ) {
+                        SUCCESS => (),
+                        error_code => return error_code,
+                    }
+
+                    ext_stdio_pipes = None;
+
+                    if set_process_group(&mut pgid, current_pid) && foreground && !shell.is_library
+                    {
+                        let _ = sys::tcsetpgrp(0, pgid);
+                    }
+
+                    resume_prior_process(&mut last_pid, current_pid);
+
+                    if let JobKind::Pipe(m) = ckind {
+                        parent = child;
+                        mode = m;
+                    } else {
+                        kind = ckind;
+                        block_child = false;
                         match spawn_proc(
                             shell,
-                            parent,
+                            child,
                             kind,
                             block_child,
                             &mut last_pid,
@@ -814,59 +792,24 @@ pub(crate) fn pipe(
                             error_code => return error_code,
                         }
 
-                        ext_stdio_pipes = None;
-
-                        if set_process_group(&mut pgid, current_pid)
-                            && foreground
-                            && !shell.is_library
-                        {
-                            let _ = sys::tcsetpgrp(0, pgid);
-                        }
-
                         resume_prior_process(&mut last_pid, current_pid);
-
-                        if let JobKind::Pipe(m) = ckind {
-                            parent = child;
-                            mode = m;
-                        } else {
-
-
-                            kind = ckind;
-                            block_child = false;
-                            match spawn_proc(
-                                shell,
-                                child,
-                                kind,
-                                block_child,
-                                &mut last_pid,
-                                &mut current_pid,
-                                pgid,
-                            ) {
-                                SUCCESS => (),
-                                error_code => return error_code,
-                            }
-
-                            resume_prior_process(&mut last_pid, current_pid);
-                            break;
-                        }
+                        break;
                     }
+                }
 
-                    set_process_group(&mut pgid, current_pid);
+                set_process_group(&mut pgid, current_pid);
 
-                    previous_status = shell.wait(pgid, remember);
-                    if previous_status == TERMINATED {
-                        if let Err(why) = sys::killpg(pgid, sys::SIGTERM) {
-                            eprintln!("ion: failed to terminate foreground jobs: {}", why);
-                        }
-                        return previous_status;
+                previous_status = shell.wait(pgid, remember);
+                if previous_status == TERMINATED {
+                    if let Err(why) = sys::killpg(pgid, sys::SIGTERM) {
+                        eprintln!("ion: failed to terminate foreground jobs: {}", why);
                     }
-                }
-                _ => {
-                    previous_status = shell.exec_job(&mut parent, foreground);
+                    return previous_status;
                 }
             }
-        } else {
-            break;
+            _ => {
+                previous_status = shell.exec_job(&mut parent, foreground);
+            }
         }
     }
 
@@ -925,9 +868,9 @@ fn spawn_proc(
                 last_pid,
                 current_pid,
                 pgid,
-                |stdout, stderr, stdin| shell.exec_builtin(main, args, stdout, stderr, stdin)
+                |stdout, stderr, stdin| shell.exec_builtin(main, args, stdout, stderr, stdin),
             );
-        },
+        }
         JobVariant::Function { ref mut name, ref mut args } => {
             fork_exec_internal(
                 stdout,
@@ -937,9 +880,9 @@ fn spawn_proc(
                 last_pid,
                 current_pid,
                 pgid,
-                |stdout, stderr, stdin| shell.exec_function(name, &args, stdout, stderr, stdin)
+                |stdout, stderr, stdin| shell.exec_function(name, &args, stdout, stderr, stdin),
             );
-        },
+        }
         JobVariant::Cat { ref mut sources } => {
             fork_exec_internal(
                 stdout,
@@ -949,9 +892,9 @@ fn spawn_proc(
                 last_pid,
                 current_pid,
                 pgid,
-                |stdout, _, stdin| shell.exec_multi_in(sources, stdout, stdin)
+                |stdout, _, stdin| shell.exec_multi_in(sources, stdout, stdin),
             );
-        },
+        }
         JobVariant::Tee { ref mut items } => {
             fork_exec_internal(
                 stdout,
@@ -961,9 +904,9 @@ fn spawn_proc(
                 last_pid,
                 current_pid,
                 pgid,
-                |stdout, stderr, stdin| shell.exec_multi_out(items, stdout, stderr, stdin, kind)
+                |stdout, stderr, stdin| shell.exec_multi_out(items, stdout, stderr, stdin, kind),
             );
-        },
+        }
     }
     SUCCESS
 }
@@ -978,7 +921,9 @@ fn fork_exec_internal<F>(
     current_pid: &mut u32,
     pgid: u32,
     mut exec_action: F,
-) where F: FnMut(&mut Option<File>, &mut Option<File>, &mut Option<File>) -> i32 {
+) where
+    F: FnMut(&mut Option<File>, &mut Option<File>, &mut Option<File>) -> i32,
+{
     match unsafe { sys::fork() } {
         Ok(0) => {
             prepare_child(block_child, pgid);
@@ -996,7 +941,7 @@ fn fork_exec_internal<F>(
             *last_pid = *current_pid;
             *current_pid = pid;
         }
-        Err(e) => pipe_fail(e)
+        Err(e) => pipe_fail(e),
     }
 }
 
diff --git a/src/lib/shell/pipe_exec/pipes.rs b/src/lib/shell/pipe_exec/pipes.rs
index 2506cbc29a9ee91d4e37f89ca0936cd489994d53..fecc3a8f1e8733297f0e9b5811118d825f730614 100644
--- a/src/lib/shell/pipe_exec/pipes.rs
+++ b/src/lib/shell/pipe_exec/pipes.rs
@@ -18,11 +18,7 @@ impl<'a> TeePipe<'a> {
         ext_stdio_pipes: &'a mut Option<Vec<File>>,
         is_external: bool,
     ) -> TeePipe<'a> {
-        TeePipe {
-            parent,
-            ext_stdio_pipes,
-            is_external,
-        }
+        TeePipe { parent, ext_stdio_pipes, is_external }
     }
 
     fn inner_connect<F>(&mut self, tee: &mut TeeItem, mut action: F)
diff --git a/src/lib/shell/pipe_exec/streams.rs b/src/lib/shell/pipe_exec/streams.rs
index be1e6154f166a51df965e5941d89f1e29d205e95..43a167955e7445d067945cd3bd35d0abe941dd39 100644
--- a/src/lib/shell/pipe_exec/streams.rs
+++ b/src/lib/shell/pipe_exec/streams.rs
@@ -17,18 +17,17 @@ pub(crate) fn redir(old: RawFd, new: RawFd) {
 /// when dropped.
 pub(crate) fn duplicate_streams() -> io::Result<(Option<File>, File, File)> {
     // STDIN may have been closed for a background shell, so it is ok if it cannot be duplicated.
-    let stdin = sys::dup(sys::STDIN_FILENO)
-        .ok()
-        .map(|fd| unsafe { File::from_raw_fd(fd) });
+    let stdin = sys::dup(sys::STDIN_FILENO).ok().map(|fd| unsafe { File::from_raw_fd(fd) });
 
     sys::dup(sys::STDOUT_FILENO)
         .map(|fd| unsafe { File::from_raw_fd(fd) })
         .map(|stdout| (stdin, stdout))
         // And then meld stderr alongside stdin and stdout
-        .and_then(|(stdin, stdout)| sys::dup(sys::STDERR_FILENO)
-            .map(|fd| unsafe { File::from_raw_fd(fd) })
-            .map(|stderr| (stdin, stdout, stderr))
-        )
+        .and_then(|(stdin, stdout)| {
+            sys::dup(sys::STDERR_FILENO)
+                .map(|fd| unsafe { File::from_raw_fd(fd) })
+                .map(|stderr| (stdin, stdout, stderr))
+        })
 }
 
 pub(crate) fn redirect_streams(inp: Option<File>, out: File, err: File) {
diff --git a/src/lib/shell/variables/mod.rs b/src/lib/shell/variables/mod.rs
index 108a50b1ed257e34797f20b893799afb8c3e54e9..c038f34b754009197ff4883bafce998288cf361e 100644
--- a/src/lib/shell/variables/mod.rs
+++ b/src/lib/shell/variables/mod.rs
@@ -127,25 +127,19 @@ impl fmt::Display for VariableType {
             VariableType::Alias(ref alias) => write!(f, "{}", **alias),
             VariableType::Array(ref array) => write!(f, "{}", array.join(" ")),
             VariableType::HashMap(ref map) => {
-                let mut format =
-                    map.into_iter()
-                        .fold(String::new(), |mut format, (_, var_type)| {
-                            format.push_str(&format!("{}", var_type));
-                            format.push(' ');
-                            format
-                        });
-                format.pop();
+                let format = map
+                    .iter()
+                    .map(|(_, var_type)| format!("{}", var_type))
+                    .collect::<Vec<_>>()
+                    .join(" ");
                 write!(f, "{}", format)
             }
             VariableType::BTreeMap(ref map) => {
-                let mut format =
-                    map.into_iter()
-                        .fold(String::new(), |mut format, (_, var_type)| {
-                            format.push_str(&format!("{}", var_type));
-                            format.push(' ');
-                            format
-                        });
-                format.pop();
+                let format = map
+                    .iter()
+                    .map(|(_, var_type)| format!("{}", var_type))
+                    .collect::<Vec<_>>()
+                    .join(" ");
                 write!(f, "{}", format)
             }
             _ => write!(f, ""),
@@ -180,12 +174,8 @@ pub struct Variables {
 
 impl Default for Variables {
     fn default() -> Self {
-        let mut map: HashMap<types::Str, VariableType> =
-            HashMap::with_capacity(64);
-        map.insert(
-            "DIRECTORY_STACK_SIZE".into(),
-            VariableType::Str("1000".into()),
-        );
+        let mut map: HashMap<types::Str, VariableType> = HashMap::with_capacity(64);
+        map.insert("DIRECTORY_STACK_SIZE".into(), VariableType::Str("1000".into()));
         map.insert("HISTORY_SIZE".into(), VariableType::Str("1000".into()));
         map.insert("HISTFILE_SIZE".into(), VariableType::Str("100000".into()));
         map.insert(
@@ -209,11 +199,7 @@ impl Default for Variables {
         );
         map.insert(
             "EUID".into(),
-            VariableType::Str(
-                geteuid()
-                    .ok()
-                    .map_or("?".into(), |id| id.to_string().into()),
-            ),
+            VariableType::Str(geteuid().ok().map_or("?".into(), |id| id.to_string().into())),
         );
 
         // Initialize the HISTFILE variable
@@ -228,10 +214,7 @@ impl Default for Variables {
         }
 
         // History Timestamps enabled variable, disabled by default
-        map.insert(
-            "HISTORY_TIMESTAMP".into(),
-            VariableType::Str("0".into())
-        );
+        map.insert("HISTORY_TIMESTAMP".into(), VariableType::Str("0".into()));
 
         map.insert(
             "HISTORY_IGNORE".into(),
@@ -245,19 +228,9 @@ impl Default for Variables {
         );
 
         // Initialize the HOST variable
-        env::set_var(
-            "HOST",
-            &self_sys::get_host_name().unwrap_or_else(|| "?".to_owned()),
-        );
+        env::set_var("HOST", &self_sys::get_host_name().unwrap_or_else(|| "?".to_owned()));
 
-        Variables {
-            flags:   0,
-            scopes:  vec![Scope {
-                vars:      map,
-                namespace: false,
-            }],
-            current: 0,
-        }
+        Variables { flags: 0, scopes: vec![Scope { vars: map, namespace: false }], current: 0 }
     }
 }
 
@@ -265,10 +238,7 @@ impl Variables {
     pub fn new_scope(&mut self, namespace: bool) {
         self.current += 1;
         if self.current >= self.scopes.len() {
-            self.scopes.push(Scope {
-                vars: HashMap::with_capacity(64),
-                namespace,
-            });
+            self.scopes.push(Scope { vars: HashMap::with_capacity(64), namespace });
         } else {
             self.scopes[self.current].namespace = namespace;
         }
@@ -394,18 +364,22 @@ impl Variables {
         }
 
         match tilde_prefix {
-            "" => if let Some(home) = sys_env::home_dir() {
-                return Some(home.to_string_lossy().to_string() + remainder);
-            },
+            "" => {
+                if let Some(home) = sys_env::home_dir() {
+                    return Some(home.to_string_lossy().to_string() + remainder);
+                }
+            }
             "+" => {
                 return Some(match env::var("PWD") {
                     Ok(var) => var + remainder,
                     _ => ["?", remainder].concat(),
-                })
+                });
+            }
+            "-" => {
+                if let Some(oldpwd) = self.get::<types::Str>("OLDPWD") {
+                    return Some(oldpwd.to_string() + remainder);
+                }
             }
-            "-" => if let Some(oldpwd) = self.get::<types::Str>("OLDPWD") {
-                return Some(oldpwd.to_string() + remainder);
-            },
             _ => {
                 let neg;
                 let tilde_num;
@@ -433,9 +407,11 @@ impl Variables {
                             return Some(path.to_str().unwrap().to_string());
                         }
                     }
-                    Err(_) => if let Some(home) = self_sys::get_user_home(tilde_prefix) {
-                        return Some(home + remainder);
-                    },
+                    Err(_) => {
+                        if let Some(home) = self_sys::get_user_home(tilde_prefix) {
+                            return Some(home + remainder);
+                        }
+                    }
                 }
             }
         }
@@ -492,19 +468,16 @@ impl Variables {
                         }
                     }
                 }
-                Some(("env", variable)) => env::var(variable)
-                    .map(Into::into)
-                    .ok()
-                    .map(|s| T::from(VariableType::Str(s))),
+                Some(("env", variable)) => {
+                    env::var(variable).map(Into::into).ok().map(|s| T::from(VariableType::Str(s)))
+                }
                 Some(("super", _)) | Some(("global", _)) | None => {
                     // Otherwise, it's just a simple variable name.
                     match self.get_ref(name) {
                         Some(VariableType::Str(val)) => {
                             Some(T::from(VariableType::Str(val.clone())))
                         }
-                        _ => env::var(name)
-                            .ok()
-                            .map(|s| T::from(VariableType::Str(s.into()))),
+                        _ => env::var(name).ok().map(|s| T::from(VariableType::Str(s.into()))),
                     }
                 }
                 Some((..)) => {
@@ -578,11 +551,13 @@ impl Variables {
                 ) -> Option<Action<'a>> {
                     if !name.is_empty() {
                         match var {
-                            VariableType::$preferred(var_value) => if var_value.is_empty() {
-                                Some(Action::Upper(UpperAction::Remove))
-                            } else {
-                                Some(Action::$preferred(input))
-                            },
+                            VariableType::$preferred(var_value) => {
+                                if var_value.is_empty() {
+                                    Some(Action::Upper(UpperAction::Remove))
+                                } else {
+                                    Some(Action::$preferred(input))
+                                }
+                            }
                             _ => Some(Action::Upper(UpperAction::Shadow)),
                         }
                     } else {
@@ -685,10 +660,7 @@ impl Variables {
             // Temporarily borrow the `swd` variable while we attempt to assemble a minimal
             // variant of the directory path. If that is not possible, we will cancel the
             // borrow and return `swd` itself as the minified path.
-            let elements = swd
-                .split('/')
-                .filter(|s| !s.is_empty())
-                .collect::<Vec<&str>>();
+            let elements = swd.split('/').filter(|s| !s.is_empty()).collect::<Vec<&str>>();
             if elements.len() > 2 {
                 let mut output = types::Str::new();
                 for element in &elements[..elements.len() - 1] {
diff --git a/src/main.rs b/src/main.rs
index 541e1981f0286bdcf87d7e0a8c80befb30a381a7..4bf8830ccf1f72ce9c81f10e655bc686c82d14cc 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -37,10 +37,7 @@ fn main() {
             "-h" | "--help" => {
                 let stdout = stdout();
                 let mut stdout = stdout.lock();
-                match stdout
-                    .write_all(MAN_ION.as_bytes())
-                    .and_then(|_| stdout.flush())
-                {
+                match stdout.write_all(MAN_ION.as_bytes()).and_then(|_| stdout.flush()) {
                     Ok(_) => return,
                     Err(err) => panic!("{}", err.description().to_owned()),
                 }