From de950c2973e20be37159952ded06a8d8aeff261d Mon Sep 17 00:00:00 2001 From: Nick Cameron Date: Mon, 14 May 2018 16:11:55 +1200 Subject: Skip on `rustfmt::skip` as well as `rustfmt_skip` --- src/utils.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') 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]) } -- cgit 1.4.1-3-g733a5