Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 56 additions & 43 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,11 +469,6 @@ fn format_lines(text: &mut StringBuffer, name: &str, config: &Config, report: &m
let mut issue_seeker = BadIssueSeeker::new(config.report_todo, config.report_fixme);

for (c, b) in text.chars() {
if c == '\r' {
line_len += c.len_utf8();
continue;
}

// Add warnings for bad todos/ fixmes
if let Some(issue) = issue_seeker.inspect(c) {
errors.push(FormattingError {
Expand All @@ -482,7 +477,7 @@ fn format_lines(text: &mut StringBuffer, name: &str, config: &Config, report: &m
});
}

if c == '\n' {
if c == '\n' || c == '\r' {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is quite right - a line ending in \r\n will be counted as two lines rather than one. I think it might be better to keep the original treatment, but don't increment line_len, although that assumes line_len is only used for the max line length test.

Copy link
Author

@ghost ghost Feb 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right, my bad. By the way, if you have a better name for this PR, don't hesitate :P

// Check for (and record) trailing whitespace.
if let Some(lw) = last_wspace {
trims.push((cur_line, lw, b));
Expand Down