parent
7c3a422742
commit
30a28a262c
4 changed files with 5 additions and 8 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -294,7 +294,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustfmt-nightly"
|
name = "rustfmt-nightly"
|
||||||
version = "0.3.7"
|
version = "0.3.8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cargo_metadata 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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)",
|
"derive-new 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
|
|
||||||
name = "rustfmt-nightly"
|
name = "rustfmt-nightly"
|
||||||
version = "0.3.7"
|
version = "0.3.8"
|
||||||
authors = ["Nicholas Cameron <ncameron@mozilla.com>", "The Rustfmt developers"]
|
authors = ["Nicholas Cameron <ncameron@mozilla.com>", "The Rustfmt developers"]
|
||||||
description = "Tool to find and fix Rust formatting issues"
|
description = "Tool to find and fix Rust formatting issues"
|
||||||
repository = "https://github.com/rust-lang-nursery/rustfmt"
|
repository = "https://github.com/rust-lang-nursery/rustfmt"
|
||||||
|
|
|
@ -48,8 +48,8 @@ pub trait LineRangeUtils {
|
||||||
|
|
||||||
impl SpanUtils for CodeMap {
|
impl SpanUtils for CodeMap {
|
||||||
fn span_after(&self, original: Span, needle: &str) -> BytePos {
|
fn span_after(&self, original: Span, needle: &str) -> BytePos {
|
||||||
let snippet = self.span_to_snippet(original).unwrap();
|
let snippet = self.span_to_snippet(original).expect("Bad snippet");
|
||||||
let offset = snippet.find_uncommented(needle).unwrap() + needle.len();
|
let offset = snippet.find_uncommented(needle).expect("Bad offset") + needle.len();
|
||||||
|
|
||||||
original.lo() + BytePos(offset as u32)
|
original.lo() + BytePos(offset as u32)
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,10 +44,7 @@ pub fn filter_inline_attrs(attrs: &[ast::Attribute], outer_span: Span) -> Vec<as
|
||||||
/// Returns true for `mod foo;`, false for `mod foo { .. }`.
|
/// Returns true for `mod foo;`, false for `mod foo { .. }`.
|
||||||
fn is_mod_decl(item: &ast::Item) -> bool {
|
fn is_mod_decl(item: &ast::Item) -> bool {
|
||||||
match item.node {
|
match item.node {
|
||||||
ast::ItemKind::Mod(ref m) => {
|
ast::ItemKind::Mod(ref m) => m.inner.hi() != item.span.hi(),
|
||||||
!(m.inner.lo() == BytePos(0) && m.inner.hi() == BytePos(0))
|
|
||||||
&& m.inner.hi() != item.span.hi()
|
|
||||||
}
|
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue