diff --git a/src/expr.rs b/src/expr.rs index 69f62319ade..8e0a5aca984 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -968,13 +968,15 @@ impl<'a> Rewrite for ControlFlow<'a> { }; // for event in event - let between_kwd_cond = mk_sp(context.codemap.span_after(self.span, self.keyword.trim()), - self.pat - .map_or(cond_span.lo, |p| if self.matcher.is_empty() { - p.span.lo - } else { - context.codemap.span_before(self.span, self.matcher.trim()) - })); + let between_kwd_cond = mk_sp( + context.codemap.span_after(self.span, self.keyword.trim()), + self.pat + .map_or(cond_span.lo, |p| if self.matcher.is_empty() { + p.span.lo + } else { + context.codemap.span_before(self.span, self.matcher.trim()) + }), + ); let between_kwd_cond_comment = extract_comment(between_kwd_cond, context, shape); diff --git a/src/lib.rs b/src/lib.rs index 49125e6ff9c..e89235631fb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -610,22 +610,24 @@ pub fn format_input(input: Input, let mut report = FormatReport::new(); - match format_ast(&krate, - &parse_session, - &main_file, - config, - |file_name, file| { - // For some reason, the codemap does not include terminating - // newlines so we must add one on for each file. This is sad. - filemap::append_newline(file); + match format_ast( + &krate, + &parse_session, + &main_file, + config, + |file_name, file| { + // For some reason, the codemap does not include terminating + // newlines so we must add one on for each file. This is sad. + filemap::append_newline(file); - format_lines(file, file_name, config, &mut report); + format_lines(file, file_name, config, &mut report); - if let Some(ref mut out) = out { - return filemap::write_file(file, file_name, out, config); + if let Some(ref mut out) = out { + return filemap::write_file(file, file_name, out, config); + } + Ok(false) } - Ok(false) - }) { + ) { Ok((file_map, has_diff)) => { if report.has_warnings() { summary.add_formatting_error(); diff --git a/src/macros.rs b/src/macros.rs index 3c6c54f42cf..1193e4819eb 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -205,10 +205,10 @@ pub fn rewrite_macro(mac: &ast::Mac, context .codemap .span_after(mac.span, original_style.opener()), - mac.span.hi - BytePos(1) + mac.span.hi - BytePos(1), ), context, - mac_shape + mac_shape, )); Some(format!("{}{}", macro_name, rewrite))