Fix test failing on windows due to crlf

This commit is contained in:
Tibo 2018-05-27 03:15:26 +10:00
parent a92a1cb512
commit 33a46581f7
No known key found for this signature in database
GPG Key ID: 2DF74CAC68BE8FCD
2 changed files with 4 additions and 4 deletions

View File

@ -209,9 +209,9 @@ impl FileLines {
self.file_range_matches(file_name, |r| r.lo <= line && r.hi >= line)
}
/// Returns true if any of the lines between `lo` and `hi` from `file_name` are in `self`.
pub(crate) fn intersects_range(&self, file_name: &FileName, lo: usize, hi: usize) -> bool {
self.file_range_matches(file_name, |r| r.intersects(Range::new(lo, hi)))
/// Returns true if all the lines between `lo` and `hi` from `file_name` are in `self`.
pub(crate) fn contains_range(&self, file_name: &FileName, lo: usize, hi: usize) -> bool {
self.file_range_matches(file_name, |r| r.contains(Range::new(lo, hi)))
}
}

View File

@ -189,7 +189,7 @@ impl<'a> FmtVisitor<'a> {
debug!("{:?}: {:?}", kind, subslice);
let newline_count = count_newlines(subslice);
let within_file_lines_range = self.config.file_lines().intersects_range(
let within_file_lines_range = self.config.file_lines().contains_range(
file_name,
status.cur_line,
status.cur_line + newline_count,