]> git.lizzy.rs Git - rust.git/blobdiff - src/macros.rs
Merge pull request #3266 from wada314/fix-2973
[rust.git] / src / macros.rs
index 53afccb53ecbaef0d6bf92c5401534164fe150ba..9ce5c913ca55f48a82cadc4c00923098d9025281 100644 (file)
@@ -42,7 +42,7 @@
 use spanned::Spanned;
 use utils::{
     format_visibility, is_empty_line, mk_sp, remove_trailing_white_spaces, rewrite_ident,
-    trim_left_preserve_layout, wrap_str,
+    trim_left_preserve_layout, wrap_str, NodeIdExt,
 };
 use visitor::FmtVisitor;
 
@@ -421,7 +421,7 @@ pub fn rewrite_macro_inner(
             // anything in between the braces (for now).
             let snippet = context.snippet(mac.span);
             let macro_raw = snippet.split_at(snippet.find('!')? + 1).1.trim_start();
-            match trim_left_preserve_layout(macro_raw, &shape.indent, &context.config) {
+            match trim_left_preserve_layout(macro_raw, shape.indent, &context.config) {
                 Some(macro_body) => Some(format!("{} {}", macro_name, macro_body)),
                 None => Some(format!("{} {}", macro_name, macro_raw)),
             }
@@ -1102,7 +1102,6 @@ fn next_space(tok: &Token) -> SpaceState {
         | Token::DotDot
         | Token::DotDotDot
         | Token::DotDotEq
-        | Token::DotEq
         | Token::Question => SpaceState::Punctuation,
 
         Token::ModSep
@@ -1127,7 +1126,7 @@ pub fn convert_try_mac(mac: &ast::Mac, context: &RewriteContext) -> Option<ast::
         let mut parser = new_parser_from_tts(context.parse_session, ts.trees().collect());
 
         Some(ast::Expr {
-            id: ast::NodeId::new(0), // dummy value
+            id: ast::NodeId::root(), // dummy value
             node: ast::ExprKind::Try(parser.parse_expr().ok()?),
             span: mac.span, // incorrect span, but shouldn't matter too much
             attrs: ThinVec::new(),
@@ -1291,7 +1290,7 @@ fn rewrite(
 
         // Indent the body since it is in a block.
         let indent_str = body_indent.to_string(&config);
-        let mut new_body = LineClasses::new(new_body.trim_right())
+        let mut new_body = LineClasses::new(new_body.trim_end())
             .enumerate()
             .fold(
                 (String::new(), true),