Skip to content

Commit

Permalink
Fix formatting in changes.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
nrc committed Apr 23, 2015
1 parent f737f76 commit 2819738
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
15 changes: 10 additions & 5 deletions src/changes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@


// TODO
// print to files
// print to files
// tests

use strings::string_buffer::StringBuffer;
use std::collections::HashMap;
use syntax::codemap::{CodeMap, Span,BytePos};
use syntax::codemap::{CodeMap, Span, BytePos};
use std::fmt;
use std::fs::File;
use std::io::Write;
Expand Down Expand Up @@ -115,7 +115,9 @@ impl<'a> ChangeSet<'a> {
}
}

pub fn write_all_files(&self, mode: WriteMode) -> Result<(HashMap<String, String>), ::std::io::Error> {
pub fn write_all_files(&self,
mode: WriteMode)
-> Result<(HashMap<String, String>), ::std::io::Error> {
let mut result = HashMap::new();
for filename in self.file_map.keys() {
let one_result = try!(self.write_file(filename, mode));
Expand All @@ -127,7 +129,10 @@ impl<'a> ChangeSet<'a> {
Ok(result)
}

pub fn write_file(&self, filename: &str, mode: WriteMode) -> Result<Option<String>, ::std::io::Error> {
pub fn write_file(&self,
filename: &str,
mode: WriteMode)
-> Result<Option<String>, ::std::io::Error> {
let text = &self.file_map[filename];

match mode {
Expand Down Expand Up @@ -194,5 +199,5 @@ impl<'a> fmt::Display for ChangeSet<'a> {
try!(write!(fmt, "{}\n\n", r));
}
Ok(())
}
}
}
3 changes: 2 additions & 1 deletion src/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ fn run(args: Vec<String>, write_mode: WriteMode) {

fn main() {
let args: Vec<_> = std::env::args().collect();
run(args, WriteMode::Display);
//run(args, WriteMode::Display);
run(args, WriteMode::NewFile("new"));
std::env::set_exit_status(0);

// TODO unit tests
Expand Down

0 comments on commit 2819738

Please sign in to comment.