Skip to content

Commit

Permalink
Print entire comment line for report_todo/report_fixme (#3912)
Browse files Browse the repository at this point in the history
  • Loading branch information
tangmi authored and topecongiro committed Nov 14, 2019
1 parent 7ecd467 commit 3773466
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/formatting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,9 @@ impl<'a> FormatLines<'a> {

// Iterate over the chars in the file map.
fn iterate(&mut self, text: &mut String) {
// List of TODO or FIXME issues on the current line
let mut issues_on_line = Vec::new();

for (kind, c) in CharClasses::new(text.chars()) {
if c == '\r' {
continue;
Expand All @@ -515,11 +518,17 @@ impl<'a> FormatLines<'a> {
if self.allow_issue_seek && self.format_line {
// Add warnings for bad todos/ fixmes
if let Some(issue) = self.issue_seeker.inspect(c) {
self.push_err(ErrorKind::BadIssue(issue), false, false);
issues_on_line.push(issue);
}
}

if c == '\n' {
// Accumulate TODO or FIXME issues for the rest of the line so the resulting error
// messages contain the entire comment line
for issue in issues_on_line.drain(..) {
self.push_err(ErrorKind::BadIssue(issue), false, false);
}

self.new_line(kind);
} else {
self.char(c, kind);
Expand Down

0 comments on commit 3773466

Please sign in to comment.