diff --git a/Cargo.lock b/Cargo.lock index ec6a1117b51..05c03910231 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -294,7 +294,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "rustfmt-nightly" -version = "0.3.7" +version = "0.3.8" dependencies = [ "cargo_metadata 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "derive-new 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 689178fecd7..a54e1fe482d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustfmt-nightly" -version = "0.3.7" +version = "0.3.8" authors = ["Nicholas Cameron ", "The Rustfmt developers"] description = "Tool to find and fix Rust formatting issues" repository = "https://github.com/rust-lang-nursery/rustfmt" diff --git a/src/codemap.rs b/src/codemap.rs index 5a8d43a072f..d74d24439d9 100644 --- a/src/codemap.rs +++ b/src/codemap.rs @@ -48,8 +48,8 @@ pub trait LineRangeUtils { impl SpanUtils for CodeMap { fn span_after(&self, original: Span, needle: &str) -> BytePos { - let snippet = self.span_to_snippet(original).unwrap(); - let offset = snippet.find_uncommented(needle).unwrap() + needle.len(); + let snippet = self.span_to_snippet(original).expect("Bad snippet"); + let offset = snippet.find_uncommented(needle).expect("Bad offset") + needle.len(); original.lo() + BytePos(offset as u32) } diff --git a/src/visitor.rs b/src/visitor.rs index 75e7c0be254..3157597697d 100644 --- a/src/visitor.rs +++ b/src/visitor.rs @@ -44,10 +44,7 @@ pub fn filter_inline_attrs(attrs: &[ast::Attribute], outer_span: Span) -> Vec bool { match item.node { - ast::ItemKind::Mod(ref m) => { - !(m.inner.lo() == BytePos(0) && m.inner.hi() == BytePos(0)) - && m.inner.hi() != item.span.hi() - } + ast::ItemKind::Mod(ref m) => m.inner.hi() != item.span.hi(), _ => false, } }