Take the inner macro_use attr into acocunt while reordering (#3749)

This commit is contained in:
Seiichi Uchida 2019-08-19 10:56:32 +09:00 committed by GitHub
parent 1643d726ef
commit 73847d3986
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 8 deletions

View File

@ -41,9 +41,6 @@ pub use crate::rustfmt_diff::{ModifiedChunk, ModifiedLines};
#[macro_use]
mod utils;
#[macro_use]
mod release_channel;
mod attr;
mod chains;
mod closures;
@ -66,6 +63,7 @@ pub(crate) mod modules;
mod overflow;
mod pairs;
mod patterns;
mod release_channel;
mod reorder;
mod rewrite;
pub(crate) mod rustfmt_diff;

View File

@ -10,7 +10,6 @@ use std::cmp::{Ord, Ordering};
use syntax::{ast, attr, source_map::Span, symbol::sym};
use crate::attr::filter_inline_attrs;
use crate::config::Config;
use crate::imports::{merge_use_trees, UseTree};
use crate::items::{is_mod_decl, rewrite_extern_crate, rewrite_mod};
@ -149,10 +148,7 @@ fn rewrite_reorderable_items(
}
fn contains_macro_use_attr(item: &ast::Item) -> bool {
attr::contains_name(
&filter_inline_attrs(&item.attrs, item.span()),
sym::macro_use,
)
attr::contains_name(&item.attrs, sym::macro_use)
}
/// A simplified version of `ast::ItemKind`.