Skip to content

Commit 3c4616d

Browse files
committed
cargo fmt
1 parent 254fad9 commit 3c4616d

File tree

3 files changed

+19
-25
lines changed

3 files changed

+19
-25
lines changed

clippy_lints/src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ use rustc::hir::intravisit::{walk_body, walk_expr, walk_ty, FnKind, NestedVisito
1010
use rustc::hir::*;
1111
use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass};
1212
use rustc::ty::layout::LayoutOf;
13+
use rustc::ty::print::Printer;
1314
use rustc::ty::{self, InferTy, Ty, TyCtxt, TypeckTables};
1415
use rustc::{declare_tool_lint, lint_array};
15-
use rustc::ty::print::Printer;
1616
use rustc_errors::Applicability;
1717
use rustc_target::spec::abi::Abi;
1818
use rustc_typeck::hir_ty_to_ty;

clippy_lints/src/use_self.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use rustc::hir::intravisit::{walk_item, walk_path, walk_ty, NestedVisitorMap, Vi
44
use rustc::hir::*;
55
use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass};
66
use rustc::ty;
7-
use rustc::{declare_tool_lint, lint_array};
87
use rustc::ty::DefIdTree;
8+
use rustc::{declare_tool_lint, lint_array};
99
use rustc_errors::Applicability;
1010
use syntax_pos::symbol::keywords::SelfUpper;
1111

clippy_lints/src/utils/mod.rs

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ use if_chain::if_chain;
2424
use matches::matches;
2525
use rustc::hir;
2626
use rustc::hir::def::Def;
27-
use rustc::hir::map::DisambiguatedDefPathData;
2827
use rustc::hir::def_id::CrateNum;
2928
use rustc::hir::def_id::{DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
3029
use rustc::hir::intravisit::{NestedVisitorMap, Visitor};
30+
use rustc::hir::map::DisambiguatedDefPathData;
3131
use rustc::hir::Node;
3232
use rustc::hir::*;
3333
use rustc::lint::{LateContext, Level, Lint, LintContext};
@@ -43,7 +43,7 @@ use rustc_errors::Applicability;
4343
use syntax::ast::{self, LitKind};
4444
use syntax::attr;
4545
use syntax::source_map::{Span, DUMMY_SP};
46-
use syntax::symbol::{keywords, Symbol, LocalInternedString};
46+
use syntax::symbol::{keywords, LocalInternedString, Symbol};
4747

4848
use crate::reexport::*;
4949

@@ -116,39 +116,30 @@ impl<'tcx> Printer<'tcx, 'tcx> for AbsolutePathPrinter<'_, 'tcx> {
116116
self.tcx
117117
}
118118

119-
fn print_region(
120-
self,
121-
_region: ty::Region<'_>,
122-
) -> Result<Self::Region, Self::Error> {
119+
fn print_region(self, _region: ty::Region<'_>) -> Result<Self::Region, Self::Error> {
123120
Ok(())
124121
}
125122

126-
fn print_type(
127-
self,
128-
_ty: Ty<'tcx>,
129-
) -> Result<Self::Type, Self::Error> {
123+
fn print_type(self, _ty: Ty<'tcx>) -> Result<Self::Type, Self::Error> {
130124
Ok(())
131125
}
132126

133127
fn print_dyn_existential(
134128
self,
135129
_predicates: &'tcx ty::List<ty::ExistentialPredicate<'tcx>>,
136-
) -> Result<Self::DynExistential, Self::Error> {
130+
) -> Result<Self::DynExistential, Self::Error> {
137131
Ok(())
138132
}
139133

140-
fn path_crate(
141-
self,
142-
cnum: CrateNum,
143-
) -> Result<Self::Path, Self::Error> {
134+
fn path_crate(self, cnum: CrateNum) -> Result<Self::Path, Self::Error> {
144135
Ok(vec![self.tcx.original_crate_name(cnum).as_str()])
145136
}
146137

147138
fn path_qualified(
148139
self,
149140
self_ty: Ty<'tcx>,
150141
trait_ref: Option<ty::TraitRef<'tcx>>,
151-
) -> Result<Self::Path, Self::Error> {
142+
) -> Result<Self::Path, Self::Error> {
152143
// This shouldn't ever be needed, but just in case:
153144
Ok(vec![match trait_ref {
154145
Some(trait_ref) => Symbol::intern(&format!("{:?}", trait_ref)).as_str(),
@@ -162,14 +153,12 @@ impl<'tcx> Printer<'tcx, 'tcx> for AbsolutePathPrinter<'_, 'tcx> {
162153
_disambiguated_data: &DisambiguatedDefPathData,
163154
self_ty: Ty<'tcx>,
164155
trait_ref: Option<ty::TraitRef<'tcx>>,
165-
) -> Result<Self::Path, Self::Error> {
156+
) -> Result<Self::Path, Self::Error> {
166157
let mut path = print_prefix(self)?;
167158

168159
// This shouldn't ever be needed, but just in case:
169160
path.push(match trait_ref {
170-
Some(trait_ref) => {
171-
Symbol::intern(&format!("<impl {} for {}>", trait_ref, self_ty)).as_str()
172-
}
161+
Some(trait_ref) => Symbol::intern(&format!("<impl {} for {}>", trait_ref, self_ty)).as_str(),
173162
None => Symbol::intern(&format!("<impl {}>", self_ty)).as_str(),
174163
});
175164

@@ -180,7 +169,7 @@ impl<'tcx> Printer<'tcx, 'tcx> for AbsolutePathPrinter<'_, 'tcx> {
180169
self,
181170
print_prefix: impl FnOnce(Self) -> Result<Self::Path, Self::Error>,
182171
disambiguated_data: &DisambiguatedDefPathData,
183-
) -> Result<Self::Path, Self::Error> {
172+
) -> Result<Self::Path, Self::Error> {
184173
let mut path = print_prefix(self)?;
185174
path.push(disambiguated_data.data.as_interned_str().as_str());
186175
Ok(path)
@@ -190,7 +179,7 @@ impl<'tcx> Printer<'tcx, 'tcx> for AbsolutePathPrinter<'_, 'tcx> {
190179
self,
191180
print_prefix: impl FnOnce(Self) -> Result<Self::Path, Self::Error>,
192181
_args: &[Kind<'tcx>],
193-
) -> Result<Self::Path, Self::Error> {
182+
) -> Result<Self::Path, Self::Error> {
194183
print_prefix(self)
195184
}
196185
}
@@ -219,7 +208,12 @@ pub fn match_def_path<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, path
219208
/// };
220209
/// ```
221210
pub fn get_def_path<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Vec<&'static str> {
222-
AbsolutePathPrinter { tcx }.print_def_path(def_id, &[]).unwrap().iter().map(LocalInternedString::get).collect()
211+
AbsolutePathPrinter { tcx }
212+
.print_def_path(def_id, &[])
213+
.unwrap()
214+
.iter()
215+
.map(LocalInternedString::get)
216+
.collect()
223217
}
224218

225219
/// Checks if type is struct, enum or union type with the given def path.

0 commit comments

Comments
 (0)