about summary refs log tree commit diff
path: root/src/tools/rustfmt
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2022-01-20 11:06:45 -0500
committerFelix S. Klock II <pnkfelix@pnkfx.org>2022-03-03 14:38:50 -0500
commite9035f7bef47c21b575af517dce309d96df4eb51 (patch)
tree80f987621f14399c7966823d918f29fd767428bd /src/tools/rustfmt
parent45660949132222ba7ec0905649b2affd68e0e13c (diff)
downloadrust-e9035f7bef47c21b575af517dce309d96df4eb51.tar.gz
rust-e9035f7bef47c21b575af517dce309d96df4eb51.zip
refactor: prepare to associate multiple spans with a module.
Diffstat (limited to 'src/tools/rustfmt')
-rw-r--r--src/tools/rustfmt/src/parse/parser.rs2
-rw-r--r--src/tools/rustfmt/src/visitor.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/tools/rustfmt/src/parse/parser.rs b/src/tools/rustfmt/src/parse/parser.rs
index f0944a88d2f..3b4e762b6dd 100644
--- a/src/tools/rustfmt/src/parse/parser.rs
+++ b/src/tools/rustfmt/src/parse/parser.rs
@@ -113,7 +113,7 @@ impl<'a> Parser<'a> {
         let result = catch_unwind(AssertUnwindSafe(|| {
             let mut parser = new_parser_from_file(sess.inner(), path, Some(span));
             match parser.parse_mod(&TokenKind::Eof) {
-                Ok(result) => Some(result),
+                Ok((a, i, ast::ModSpans { inner_span })) => Some((a, i, inner_span)),
                 Err(mut e) => {
                     e.emit();
                     if sess.can_reset_errors() {
diff --git a/src/tools/rustfmt/src/visitor.rs b/src/tools/rustfmt/src/visitor.rs
index 0177689958a..57a58c60484 100644
--- a/src/tools/rustfmt/src/visitor.rs
+++ b/src/tools/rustfmt/src/visitor.rs
@@ -915,7 +915,7 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
         let ident_str = rewrite_ident(&self.get_context(), ident).to_owned();
         self.push_str(&ident_str);
 
-        if let ast::ModKind::Loaded(ref items, ast::Inline::Yes, inner_span) = mod_kind {
+        if let ast::ModKind::Loaded(ref items, ast::Inline::Yes, ast::ModSpans{ inner_span }) = mod_kind {
             match self.config.brace_style() {
                 BraceStyle::AlwaysNextLine => {
                     let indent_str = self.block_indent.to_string_with_newline(self.config);