Apply rustfmt::skip on imports (#3289)

This commit is contained in:
Seiichi Uchida 2019-01-27 16:26:09 +09:00 committed by GitHub
parent 4e7eda420c
commit 35d5ef7828
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 3 deletions

View file

@ -10,7 +10,7 @@
//! Reorder items.
//!
//! `mod`, `extern crate` and `use` declarations are reorderd in alphabetical
//! `mod`, `extern crate` and `use` declarations are reordered in alphabetical
//! order. Trait items are reordered in pre-determined order (associated types
//! and constants comes before methods).
@ -28,7 +28,7 @@ use rewrite::{Rewrite, RewriteContext};
use shape::Shape;
use source_map::LineRangeUtils;
use spanned::Spanned;
use utils::mk_sp;
use utils::{contains_skip, mk_sp};
use visitor::FmtVisitor;
use std::cmp::{Ord, Ordering};
@ -186,7 +186,9 @@ enum ReorderableItemKind {
impl ReorderableItemKind {
fn from(item: &ast::Item) -> Self {
match item.node {
_ if contains_macro_use_attr(item) => ReorderableItemKind::Other,
_ if contains_macro_use_attr(item) | contains_skip(&item.attrs) => {
ReorderableItemKind::Other
}
ast::ItemKind::ExternCrate(..) => ReorderableItemKind::ExternCrate,
ast::ItemKind::Mod(..) if is_mod_decl(item) => ReorderableItemKind::Mod,
ast::ItemKind::Use(..) => ReorderableItemKind::Use,

View file

@ -101,3 +101,7 @@ use imports_with_attr;
// #2888
use std::f64::consts::{SQRT_2, E, PI};
// #3273
#[rustfmt::skip]
use std::fmt::{self, {Display, Formatter}};

View file

@ -123,3 +123,7 @@ use imports_with_attr;
// #2888
use std::f64::consts::{E, PI, SQRT_2};
// #3273
#[rustfmt::skip]
use std::fmt::{self, {Display, Formatter}};