diff --git a/src/librustc_span/source_map.rs b/src/librustc_span/source_map.rs index 39eb318a785..8f806909f00 100644 --- a/src/librustc_span/source_map.rs +++ b/src/librustc_span/source_map.rs @@ -370,11 +370,11 @@ impl SourceMap { pub fn doctest_offset_line(&self, file: &FileName, orig: usize) -> usize { match file { FileName::DocTest(_, offset) => { - return if *offset >= 0 { - orig + *offset as usize - } else { + if *offset < 0 { orig - (-(*offset)) as usize - }; + } else { + orig + *offset as usize + } } _ => orig, } diff --git a/src/librustdoc/theme.rs b/src/librustdoc/theme.rs index a8a571e7c54..9dd1d3706ff 100644 --- a/src/librustdoc/theme.rs +++ b/src/librustdoc/theme.rs @@ -234,9 +234,7 @@ pub fn load_css_paths(v: &[u8]) -> CssPath { } pub fn get_differences(against: &CssPath, other: &CssPath, v: &mut Vec) { - if against.name != other.name { - return; - } else { + if against.name == other.name { for child in &against.children { let mut found = false; let mut found_working = false;