diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2018-05-14 16:11:55 +1200 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2018-05-14 16:13:21 +1200 |
| commit | de950c2973e20be37159952ded06a8d8aeff261d (patch) | |
| tree | 7d9d75f32c8b43c10609b92a3e2bd2149175edb7 /src | |
| parent | 7eb8bdbbd29bfc8c781948215e9291d64aa69cf4 (diff) | |
Skip on `rustfmt::skip` as well as `rustfmt_skip`
Diffstat (limited to 'src')
| -rw-r--r-- | src/utils.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/utils.rs b/src/utils.rs index ca8a7ad7814..2556fa2c97f 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -22,8 +22,8 @@ use config::Color; use rewrite::RewriteContext; use shape::Shape; -// When we get scoped annotations, we should have rustfmt::skip. -const SKIP_ANNOTATION: &str = "rustfmt_skip"; +const DEPR_SKIP_ANNOTATION: &str = "rustfmt_skip"; +const SKIP_ANNOTATION: &str = "rustfmt::skip"; // Computes the length of a string's last line, minus offset. pub fn extra_offset(text: &str, shape: Shape) -> usize { @@ -212,7 +212,10 @@ pub fn last_line_extendable(s: &str) -> bool { #[inline] fn is_skip(meta_item: &MetaItem) -> bool { match meta_item.node { - MetaItemKind::Word => meta_item.name() == SKIP_ANNOTATION, + MetaItemKind::Word => { + let path_str = meta_item.ident.to_string(); + path_str == SKIP_ANNOTATION || path_str == DEPR_SKIP_ANNOTATION + } MetaItemKind::List(ref l) => { meta_item.name() == "cfg_attr" && l.len() == 2 && is_skip_nested(&l[1]) } |
