From 3c4616d3034d4fd4c5d737261b14900e247e9b9c Mon Sep 17 00:00:00 2001 From: flip1995 Date: Sat, 16 Mar 2019 11:51:57 +0100 Subject: [PATCH] cargo fmt --- clippy_lints/src/types.rs | 2 +- clippy_lints/src/use_self.rs | 2 +- clippy_lints/src/utils/mod.rs | 40 +++++++++++++++-------------------- 3 files changed, 19 insertions(+), 25 deletions(-) diff --git a/clippy_lints/src/types.rs b/clippy_lints/src/types.rs index 4433acf8efd..2e50222c8a9 100644 --- a/clippy_lints/src/types.rs +++ b/clippy_lints/src/types.rs @@ -10,9 +10,9 @@ use rustc::hir::*; use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass}; use rustc::ty::layout::LayoutOf; +use rustc::ty::print::Printer; use rustc::ty::{self, InferTy, Ty, TyCtxt, TypeckTables}; use rustc::{declare_tool_lint, lint_array}; -use rustc::ty::print::Printer; use rustc_errors::Applicability; use rustc_target::spec::abi::Abi; use rustc_typeck::hir_ty_to_ty; diff --git a/clippy_lints/src/use_self.rs b/clippy_lints/src/use_self.rs index 8fc4457aad2..ac901ab062f 100644 --- a/clippy_lints/src/use_self.rs +++ b/clippy_lints/src/use_self.rs @@ -4,8 +4,8 @@ use rustc::hir::*; use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass}; use rustc::ty; -use rustc::{declare_tool_lint, lint_array}; use rustc::ty::DefIdTree; +use rustc::{declare_tool_lint, lint_array}; use rustc_errors::Applicability; use syntax_pos::symbol::keywords::SelfUpper; diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs index 632e96abb99..aef53ea626b 100644 --- a/clippy_lints/src/utils/mod.rs +++ b/clippy_lints/src/utils/mod.rs @@ -24,10 +24,10 @@ use matches::matches; use rustc::hir; use rustc::hir::def::Def; -use rustc::hir::map::DisambiguatedDefPathData; use rustc::hir::def_id::CrateNum; use rustc::hir::def_id::{DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; use rustc::hir::intravisit::{NestedVisitorMap, Visitor}; +use rustc::hir::map::DisambiguatedDefPathData; use rustc::hir::Node; use rustc::hir::*; use rustc::lint::{LateContext, Level, Lint, LintContext}; @@ -43,7 +43,7 @@ use syntax::ast::{self, LitKind}; use syntax::attr; use syntax::source_map::{Span, DUMMY_SP}; -use syntax::symbol::{keywords, Symbol, LocalInternedString}; +use syntax::symbol::{keywords, LocalInternedString, Symbol}; use crate::reexport::*; @@ -116,31 +116,22 @@ fn tcx<'a>(&'a self) -> TyCtxt<'a, 'tcx, 'tcx> { self.tcx } - fn print_region( - self, - _region: ty::Region<'_>, - ) -> Result { + fn print_region(self, _region: ty::Region<'_>) -> Result { Ok(()) } - fn print_type( - self, - _ty: Ty<'tcx>, - ) -> Result { + fn print_type(self, _ty: Ty<'tcx>) -> Result { Ok(()) } fn print_dyn_existential( self, _predicates: &'tcx ty::List>, - ) -> Result { + ) -> Result { Ok(()) } - fn path_crate( - self, - cnum: CrateNum, - ) -> Result { + fn path_crate(self, cnum: CrateNum) -> Result { Ok(vec![self.tcx.original_crate_name(cnum).as_str()]) } @@ -148,7 +139,7 @@ fn path_qualified( self, self_ty: Ty<'tcx>, trait_ref: Option>, - ) -> Result { + ) -> Result { // This shouldn't ever be needed, but just in case: Ok(vec![match trait_ref { Some(trait_ref) => Symbol::intern(&format!("{:?}", trait_ref)).as_str(), @@ -162,14 +153,12 @@ fn path_append_impl( _disambiguated_data: &DisambiguatedDefPathData, self_ty: Ty<'tcx>, trait_ref: Option>, - ) -> Result { + ) -> Result { let mut path = print_prefix(self)?; // This shouldn't ever be needed, but just in case: path.push(match trait_ref { - Some(trait_ref) => { - Symbol::intern(&format!("", trait_ref, self_ty)).as_str() - } + Some(trait_ref) => Symbol::intern(&format!("", trait_ref, self_ty)).as_str(), None => Symbol::intern(&format!("", self_ty)).as_str(), }); @@ -180,7 +169,7 @@ fn path_append( self, print_prefix: impl FnOnce(Self) -> Result, disambiguated_data: &DisambiguatedDefPathData, - ) -> Result { + ) -> Result { let mut path = print_prefix(self)?; path.push(disambiguated_data.data.as_interned_str().as_str()); Ok(path) @@ -190,7 +179,7 @@ fn path_generic_args( self, print_prefix: impl FnOnce(Self) -> Result, _args: &[Kind<'tcx>], - ) -> Result { + ) -> Result { print_prefix(self) } } @@ -219,7 +208,12 @@ pub fn match_def_path<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, path /// }; /// ``` pub fn get_def_path<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Vec<&'static str> { - AbsolutePathPrinter { tcx }.print_def_path(def_id, &[]).unwrap().iter().map(LocalInternedString::get).collect() + AbsolutePathPrinter { tcx } + .print_def_path(def_id, &[]) + .unwrap() + .iter() + .map(LocalInternedString::get) + .collect() } /// Checks if type is struct, enum or union type with the given def path.