@@ -78,7 +78,7 @@ pub mod visitors;
78
78
pub use self :: attrs:: * ;
79
79
pub use self :: check_proc_macro:: { is_from_proc_macro, is_span_if, is_span_match} ;
80
80
pub use self :: hir_utils:: {
81
- both, count_eq, eq_expr_value, hash_expr, hash_stmt, is_bool, over, HirEqInterExpr , SpanlessEq , SpanlessHash ,
81
+ HirEqInterExpr , SpanlessEq , SpanlessHash , both, count_eq, eq_expr_value, hash_expr, hash_stmt, is_bool, over,
82
82
} ;
83
83
84
84
use core:: mem;
@@ -94,20 +94,20 @@ use rustc_ast::ast::{self, LitKind, RangeLimits};
94
94
use rustc_data_structures:: fx:: FxHashMap ;
95
95
use rustc_data_structures:: packed:: Pu128 ;
96
96
use rustc_data_structures:: unhash:: UnhashMap ;
97
+ use rustc_hir:: LangItem :: { OptionNone , OptionSome , ResultErr , ResultOk } ;
97
98
use rustc_hir:: def:: { DefKind , Res } ;
98
- use rustc_hir:: def_id:: { CrateNum , DefId , DefIdMap , LocalDefId , LocalModDefId , LOCAL_CRATE } ;
99
+ use rustc_hir:: def_id:: { CrateNum , DefId , DefIdMap , LOCAL_CRATE , LocalDefId , LocalModDefId } ;
99
100
use rustc_hir:: definitions:: { DefPath , DefPathData } ;
100
101
use rustc_hir:: hir_id:: { HirIdMap , HirIdSet } ;
101
- use rustc_hir:: intravisit:: { walk_expr, FnKind , Visitor } ;
102
- use rustc_hir:: LangItem :: { OptionNone , OptionSome , ResultErr , ResultOk } ;
102
+ use rustc_hir:: intravisit:: { FnKind , Visitor , walk_expr} ;
103
103
use rustc_hir:: {
104
- self as hir, def , Arm , ArrayLen , BindingMode , Block , BlockCheckMode , Body , ByRef , Closure , ConstArgKind ,
105
- ConstContext , Destination , Expr , ExprField , ExprKind , FnDecl , FnRetTy , GenericArgs , HirId , Impl , ImplItem ,
106
- ImplItemKind , ImplItemRef , Item , ItemKind , LangItem , LetStmt , MatchSource , Mutability , Node , OwnerId , OwnerNode ,
107
- Param , Pat , PatKind , Path , PathSegment , PrimTy , QPath , Stmt , StmtKind , TraitItem , TraitItemKind , TraitItemRef ,
108
- TraitRef , TyKind , UnOp ,
104
+ self as hir, Arm , ArrayLen , BindingMode , Block , BlockCheckMode , Body , ByRef , Closure , ConstArgKind , ConstContext ,
105
+ Destination , Expr , ExprField , ExprKind , FnDecl , FnRetTy , GenericArgs , HirId , Impl , ImplItem , ImplItemKind ,
106
+ ImplItemRef , Item , ItemKind , LangItem , LetStmt , MatchSource , Mutability , Node , OwnerId , OwnerNode , Param , Pat ,
107
+ PatKind , Path , PathSegment , PrimTy , QPath , Stmt , StmtKind , TraitItem , TraitItemKind , TraitItemRef , TraitRef ,
108
+ TyKind , UnOp , def ,
109
109
} ;
110
- use rustc_lexer:: { tokenize , TokenKind } ;
110
+ use rustc_lexer:: { TokenKind , tokenize } ;
111
111
use rustc_lint:: { LateContext , Level , Lint , LintContext } ;
112
112
use rustc_middle:: hir:: place:: PlaceBase ;
113
113
use rustc_middle:: mir:: Const ;
@@ -120,12 +120,12 @@ use rustc_middle::ty::{
120
120
} ;
121
121
use rustc_span:: hygiene:: { ExpnKind , MacroKind } ;
122
122
use rustc_span:: source_map:: SourceMap ;
123
- use rustc_span:: symbol:: { kw , Ident , Symbol } ;
124
- use rustc_span:: { sym , Span } ;
123
+ use rustc_span:: symbol:: { Ident , Symbol , kw } ;
124
+ use rustc_span:: { Span , sym } ;
125
125
use rustc_target:: abi:: Integer ;
126
126
use visitors:: Visitable ;
127
127
128
- use crate :: consts:: { mir_to_const , ConstEvalCtxt , Constant } ;
128
+ use crate :: consts:: { ConstEvalCtxt , Constant , mir_to_const } ;
129
129
use crate :: higher:: Range ;
130
130
use crate :: ty:: { adt_and_variant_of_res, can_partially_move_ty, expr_sig, is_copy, is_recursively_primitive_type} ;
131
131
use crate :: visitors:: for_each_expr_without_closures;
@@ -263,9 +263,13 @@ pub fn is_res_lang_ctor(cx: &LateContext<'_>, res: Res, lang_item: LangItem) ->
263
263
}
264
264
}
265
265
266
-
267
266
/// Checks if `{ctor_call_id}(...)` is `{enum_item}::{variant_name}(...)`.
268
- pub fn is_enum_variant_ctor ( cx : & LateContext < ' _ > , enum_item : Symbol , variant_name : Symbol , ctor_call_id : DefId ) -> bool {
267
+ pub fn is_enum_variant_ctor (
268
+ cx : & LateContext < ' _ > ,
269
+ enum_item : Symbol ,
270
+ variant_name : Symbol ,
271
+ ctor_call_id : DefId ,
272
+ ) -> bool {
269
273
let Some ( enum_def_id) = cx. tcx . get_diagnostic_item ( enum_item) else {
270
274
return false ;
271
275
} ;
@@ -589,14 +593,11 @@ fn find_primitive_impls<'tcx>(tcx: TyCtxt<'tcx>, name: &str) -> impl Iterator<It
589
593
"f32" => SimplifiedType :: Float ( FloatTy :: F32 ) ,
590
594
"f64" => SimplifiedType :: Float ( FloatTy :: F64 ) ,
591
595
_ => {
592
- return Result :: < & [ _ ] , rustc_errors:: ErrorGuaranteed > :: Ok ( & [ ] )
593
- . into_iter ( )
594
- . flatten ( )
595
- . copied ( ) ;
596
+ return [ ] . iter ( ) . copied ( ) ;
596
597
} ,
597
598
} ;
598
599
599
- tcx. incoherent_impls ( ty) . into_iter ( ) . flatten ( ) . copied ( )
600
+ tcx. incoherent_impls ( ty) . into_iter ( ) . copied ( )
600
601
}
601
602
602
603
fn non_local_item_children_by_name ( tcx : TyCtxt < ' _ > , def_id : DefId , name : Symbol ) -> Vec < Res > {
@@ -721,7 +722,6 @@ pub fn def_path_res(tcx: TyCtxt<'_>, path: &[&str]) -> Vec<Res> {
721
722
let inherent_impl_children = tcx
722
723
. inherent_impls ( def_id)
723
724
. into_iter ( )
724
- . flatten ( )
725
725
. flat_map ( |& impl_def_id| item_children_by_name ( tcx, impl_def_id, segment) ) ;
726
726
727
727
let direct_children = item_children_by_name ( tcx, def_id, segment) ;
0 commit comments