]> git.lizzy.rs Git - rust.git/blobdiff - src/formatting.rs
Merge pull request #3129 from otavio/issue-3104
[rust.git] / src / formatting.rs
index a07cdcc8a14972bda37f4cffdcac1c8ad1ec9396..039276ba6e886b39a54b1581d3ef459ce30833f7 100644 (file)
@@ -173,9 +173,11 @@ fn format_file(
         if visitor.macro_rewrite_failure {
             self.report.add_macro_format_failure();
         }
+        self.report
+            .add_non_formatted_ranges(visitor.skipped_range.clone());
 
         self.handler
-            .handle_formatted_file(path, visitor.buffer, &mut self.report)
+            .handle_formatted_file(path, visitor.buffer.to_owned(), &mut self.report)
     }
 }
 
@@ -240,7 +242,8 @@ pub(crate) fn from_span(
                     fl.file
                         .get_line(fl.lines[0].line_index)
                         .map(|l| l.into_owned())
-                }).unwrap_or_else(String::new),
+                })
+                .unwrap_or_else(String::new),
         }
     }
 
@@ -271,6 +274,7 @@ pub(crate) fn format_len(&self) -> (usize, usize) {
             ErrorKind::LineOverflow(found, max) => (max, found - max),
             ErrorKind::TrailingWhitespace
             | ErrorKind::DeprecatedAttr
+            | ErrorKind::BadIssue(_)
             | ErrorKind::BadAttr
             | ErrorKind::LostComment => {
                 let trailing_ws_start = self
@@ -526,7 +530,8 @@ fn new_line(&mut self, kind: FullCodeCharKind) {
                 && !self.is_skipped_line()
                 && self.should_report_error(kind, &error_kind)
             {
-                self.push_err(error_kind, kind.is_comment(), self.is_string);
+                let is_string = self.is_string;
+                self.push_err(error_kind, kind.is_comment(), is_string);
             }
         }