changeset 100:50ab6ea515b1

rust fmt
author Lewin Bormann <lbo@spheniscida.de>
date Mon, 08 Feb 2016 20:55:44 +0000
parents e6b0d8ebe0f1
children f4de6139bf2d
files src/controller.rs src/formats/writelog.rs src/input_cache.rs src/reduce.rs src/sort.rs
diffstat 5 files changed, 37 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/controller.rs	Mon Feb 08 20:36:55 2016 +0000
+++ b/src/controller.rs	Mon Feb 08 20:55:44 2016 +0000
@@ -72,9 +72,7 @@
         map_part._run();
     }
 
-    fn read_map_input<In: Iterator<Item = Record>>(it: &mut In,
-                                                   approx_bytes: usize)
-                                                   -> InputCache {
+    fn read_map_input<In: Iterator<Item = Record>>(it: &mut In, approx_bytes: usize) -> InputCache {
 
         let inp_cache = InputCache::from_iter(8192, approx_bytes, it);
         inp_cache
@@ -141,7 +139,10 @@
         if !self.params.keep_temp_files {
             for mpart in 0..self.map_partitions_run {
                 for rshard in 0..self.params.reducers {
-                    let name = fmt::format(format_args!("{}{}.{}", self.params.map_output_location, mpart, rshard));
+                    let name = fmt::format(format_args!("{}{}.{}",
+                                                        self.params.map_output_location,
+                                                        mpart,
+                                                        rshard));
                     let _ = fs::remove_file(name);
                 }
             }
--- a/src/formats/writelog.rs	Mon Feb 08 20:36:55 2016 +0000
+++ b/src/formats/writelog.rs	Mon Feb 08 20:55:44 2016 +0000
@@ -153,7 +153,9 @@
         fs::OpenOptions::new()
             .read(true)
             .open(file)
-            .map(move |f| WriteLogReader::new(Box::new(io::BufReader::with_capacity(1024 * 1024, f))))
+            .map(move |f| {
+                WriteLogReader::new(Box::new(io::BufReader::with_capacity(1024 * 1024, f)))
+            })
     }
 
     /// Opens all files from a directory which end in suffix, and chains them together.
@@ -176,7 +178,10 @@
                         println!("Error opening {:?}: {}", name, e);
                         continue;
                     }
-                    Ok(f) => reader = Box::new(reader.chain(io::BufReader::with_capacity(1024 * 1024, f))),
+                    Ok(f) => {
+                        reader = Box::new(reader.chain(io::BufReader::with_capacity(1024 * 1024,
+                                                                                    f)))
+                    }
                 }
             }
         }
@@ -204,7 +209,7 @@
                             return Err(io::Error::new(io::ErrorKind::InvalidData,
                                                       "Could not read enough data"));
                         } else {
-                            return Ok(0)
+                            return Ok(0);
                         }
                     } else if off + s < len {
                         off += s;
--- a/src/input_cache.rs	Mon Feb 08 20:36:55 2016 +0000
+++ b/src/input_cache.rs	Mon Feb 08 20:55:44 2016 +0000
@@ -14,7 +14,10 @@
 }
 
 impl InputCache {
-    pub fn from_iter<It: IntoIterator<Item = Record>>(chunk_length: usize, max_bytes: usize, it: It) -> Self {
+    pub fn from_iter<It: IntoIterator<Item = Record>>(chunk_length: usize,
+                                                      max_bytes: usize,
+                                                      it: It)
+                                                      -> Self {
         let mut chunklist = LinkedList::new();
         let mut chunk = Vec::with_capacity(chunk_length);
 
@@ -44,10 +47,18 @@
         }
 
         if chunklist.len() == 0 {
-            InputCache { len: 0, chunks_iter: LinkedList::new().into_iter(), chunk_iter: Vec::new().into_iter() }
+            InputCache {
+                len: 0,
+                chunks_iter: LinkedList::new().into_iter(),
+                chunk_iter: Vec::new().into_iter(),
+            }
         } else {
             let first_chunk_iterator = chunklist.pop_front().unwrap().into_iter();
-            InputCache { len: complete_length, chunks_iter: chunklist.into_iter(), chunk_iter: first_chunk_iterator }
+            InputCache {
+                len: complete_length,
+                chunks_iter: chunklist.into_iter(),
+                chunk_iter: first_chunk_iterator,
+            }
         }
     }
 
@@ -67,8 +78,8 @@
             None => (),
             Some(chunk) => {
                 self.chunk_iter = chunk.into_iter();
-                return self.chunk_iter.next()
-            },
+                return self.chunk_iter.next();
+            }
         }
         None
     }
--- a/src/reduce.rs	Mon Feb 08 20:36:55 2016 +0000
+++ b/src/reduce.rs	Mon Feb 08 20:55:44 2016 +0000
@@ -210,7 +210,10 @@
         let srcs = vec![get_records().into_iter()];
         let dst = LinesSinkGenerator::new_to_files();
 
-        let r = ReducePartition::new(mr, params, srcs, dst.new_output(&String::from("testdata/result_0")));
+        let r = ReducePartition::new(mr,
+                                     params,
+                                     srcs,
+                                     dst.new_output(&String::from("testdata/result_0")));
         r._run();
     }
 }
--- a/src/sort.rs	Mon Feb 08 20:36:55 2016 +0000
+++ b/src/sort.rs	Mon Feb 08 20:55:44 2016 +0000
@@ -105,14 +105,16 @@
 
 impl PartialOrd for DictComparableString {
     fn partial_cmp(&self, other: &DictComparableString) -> Option<Ordering> {
-        let (&DictComparableString::DCS(ref a), &DictComparableString::DCS(ref b)) = (self, other);
+        let (&DictComparableString::DCS(ref a),
+             &DictComparableString::DCS(ref b)) = (self, other);
         Some(dict_string_compare(a, b))
     }
 }
 
 impl Ord for DictComparableString {
     fn cmp(&self, other: &DictComparableString) -> Ordering {
-        let (&DictComparableString::DCS(ref a), &DictComparableString::DCS(ref b)) = (self, other);
+        let (&DictComparableString::DCS(ref a),
+             &DictComparableString::DCS(ref b)) = (self, other);
         dict_string_compare(a, b)
     }
 }