Fix rustfmt::skip detection

This commit is contained in:
Mateusz Mikuła 2019-03-18 12:29:56 +01:00 committed by Mateusz Mikuła
parent fb7699d9e5
commit 8feb2c6b2f

View file

@ -527,7 +527,8 @@ impl EarlyLintPass for CfgAttrPass {
if feature_item.check_name("rustfmt");
// check for `rustfmt_skip` and `rustfmt::skip`
if let Some(skip_item) = &items[1].meta_item();
if skip_item.check_name("rustfmt_skip") || skip_item.check_name("skip");
if skip_item.check_name("rustfmt_skip") ||
skip_item.path.segments.last().expect("empty path in attribute").ident.name == "skip";
// Only lint outer attributes, because custom inner attributes are unstable
// Tracking issue: https://github.com/rust-lang/rust/issues/54726
if let AttrStyle::Outer = attr.style;