diff --git a/src/comment.rs b/src/comment.rs index f5ba982ecc0e..b08e46681a7d 100644 --- a/src/comment.rs +++ b/src/comment.rs @@ -212,7 +212,10 @@ enum CodeCharKind { impl CharClasses where T: Iterator, T::Item: RichChar { fn new(base: T) -> CharClasses { - CharClasses { base: base.peekable(), status: CharClassesStatus::Normal } + CharClasses { + base: base.peekable(), + status: CharClassesStatus::Normal, + } } } diff --git a/src/issues.rs b/src/issues.rs index 90123cf63e15..2a5eaae287a1 100644 --- a/src/issues.rs +++ b/src/issues.rs @@ -101,7 +101,10 @@ pub struct BadIssueSeeker { impl BadIssueSeeker { pub fn new(report_todo: ReportTactic, report_fixme: ReportTactic) -> BadIssueSeeker { BadIssueSeeker { - state: Seeking::Issue { todo_idx: 0, fixme_idx: 0 }, + state: Seeking::Issue { + todo_idx: 0, + fixme_idx: 0, + }, report_todo: report_todo, report_fixme: report_fixme, } @@ -121,7 +124,10 @@ impl BadIssueSeeker { return None; } - self.state = Seeking::Issue { todo_idx: 0, fixme_idx: 0 }; + self.state = Seeking::Issue { + todo_idx: 0, + fixme_idx: 0, + }; if let IssueClassification::Bad(issue) = result { return Some(issue); @@ -173,7 +179,10 @@ impl BadIssueSeeker { fixme_idx = 0; } - Seeking::Issue { todo_idx: todo_idx, fixme_idx: fixme_idx } + Seeking::Issue { + todo_idx: todo_idx, + fixme_idx: fixme_idx, + } } fn inspect_number(&mut self, @@ -214,7 +223,10 @@ impl BadIssueSeeker { NumberPart::CloseParen => {} } - self.state = Seeking::Number { part: part, issue: issue }; + self.state = Seeking::Number { + part: part, + issue: issue, + }; IssueClassification::None } @@ -274,7 +286,10 @@ fn find_issue() { #[test] fn issue_type() { let mut seeker = BadIssueSeeker::new(ReportTactic::Always, ReportTactic::Never); - let expected = Some(Issue { issue_type: IssueType::Todo, missing_number: false }); + let expected = Some(Issue { + issue_type: IssueType::Todo, + missing_number: false, + }); assert_eq!(expected, "TODO(#100): more awesomeness" @@ -284,7 +299,10 @@ fn issue_type() { .unwrap()); let mut seeker = BadIssueSeeker::new(ReportTactic::Never, ReportTactic::Unnumbered); - let expected = Some(Issue { issue_type: IssueType::Fixme, missing_number: true }); + let expected = Some(Issue { + issue_type: IssueType::Fixme, + missing_number: true, + }); assert_eq!(expected, "Test. FIXME: bad, bad, not good" diff --git a/src/lib.rs b/src/lib.rs index 73184a0bdc1a..19398208a77d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -92,7 +92,10 @@ pub struct Indent { impl Indent { pub fn new(block_indent: usize, alignment: usize) -> Indent { - Indent { block_indent: block_indent, alignment: alignment } + Indent { + block_indent: block_indent, + alignment: alignment, + } } pub fn empty() -> Indent { @@ -304,7 +307,10 @@ pub fn fmt_lines(file_map: &mut FileMap, config: &Config) -> FormatReport { // Add warnings for bad todos/ fixmes if let Some(issue) = issue_seeker.inspect(c) { - errors.push(FormattingError { line: cur_line, kind: ErrorKind::BadIssue(issue) }); + errors.push(FormattingError { + line: cur_line, + kind: ErrorKind::BadIssue(issue), + }); } if c == '\n' { @@ -315,7 +321,10 @@ pub fn fmt_lines(file_map: &mut FileMap, config: &Config) -> FormatReport { } // Check for any line width errors we couldn't correct. if line_len > config.max_width { - errors.push(FormattingError { line: cur_line, kind: ErrorKind::LineOverflow }); + errors.push(FormattingError { + line: cur_line, + kind: ErrorKind::LineOverflow, + }); } line_len = 0; cur_line += 1; @@ -340,7 +349,10 @@ pub fn fmt_lines(file_map: &mut FileMap, config: &Config) -> FormatReport { } for &(l, _, _) in &trims { - errors.push(FormattingError { line: l, kind: ErrorKind::TrailingWhitespace }); + errors.push(FormattingError { + line: l, + kind: ErrorKind::TrailingWhitespace, + }); } report.file_error_map.insert(f.to_owned(), errors); @@ -395,7 +407,10 @@ pub fn format(args: Vec, config: &Config) -> FileMap { { let config = Rc::new(config.clone()); - let mut call_ctxt = RustFmtCalls { config: config, result: result.clone() }; + let mut call_ctxt = RustFmtCalls { + config: config, + result: result.clone(), + }; rustc_driver::run_compiler(&args, &mut call_ctxt); } diff --git a/src/lists.rs b/src/lists.rs index c372be2fe8f6..12eebb7b6918 100644 --- a/src/lists.rs +++ b/src/lists.rs @@ -107,7 +107,12 @@ impl ListItem { } pub fn from_str>(s: S) -> ListItem { - ListItem { pre_comment: None, item: s.into(), post_comment: None, new_lines: false } + ListItem { + pre_comment: None, + item: s.into(), + post_comment: None, + new_lines: false, + } } } diff --git a/src/rustfmt_diff.rs b/src/rustfmt_diff.rs index 375cfd661fa3..8c20b8f5a0f0 100644 --- a/src/rustfmt_diff.rs +++ b/src/rustfmt_diff.rs @@ -15,7 +15,10 @@ pub struct Mismatch { impl Mismatch { fn new(line_number: u32) -> Mismatch { - Mismatch { line_number: line_number, lines: Vec::new() } + Mismatch { + line_number: line_number, + lines: Vec::new(), + } } } diff --git a/src/visitor.rs b/src/visitor.rs index 5faff9e6d111..883d46a22d43 100644 --- a/src/visitor.rs +++ b/src/visitor.rs @@ -275,7 +275,10 @@ impl<'a> FmtVisitor<'a> { codemap: codemap, buffer: StringBuffer::new(), last_pos: BytePos(0), - block_indent: Indent { block_indent: 0, alignment: 0 }, + block_indent: Indent { + block_indent: 0, + alignment: 0, + }, config: config, } }