@@ -46,7 +46,6 @@ use rustc_lint::{LateContext, Level, Lint, LintContext};
46
46
use rustc_middle:: hir:: map:: Map ;
47
47
use rustc_middle:: ty:: subst:: { GenericArg , GenericArgKind } ;
48
48
use rustc_middle:: ty:: { self , layout:: IntegerExt , Ty , TyCtxt , TypeFoldable } ;
49
- use rustc_mir:: const_eval;
50
49
use rustc_span:: hygiene:: { ExpnKind , MacroKind } ;
51
50
use rustc_span:: source_map:: original_sp;
52
51
use rustc_span:: symbol:: { self , kw, Symbol } ;
@@ -883,19 +882,11 @@ pub fn is_copy<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> bool {
883
882
884
883
/// Checks if an expression is constructing a tuple-like enum variant or struct
885
884
pub fn is_ctor_or_promotable_const_function ( cx : & LateContext < ' _ > , expr : & Expr < ' _ > ) -> bool {
886
- fn has_no_arguments ( cx : & LateContext < ' _ > , def_id : DefId ) -> bool {
887
- cx. tcx . fn_sig ( def_id) . skip_binder ( ) . inputs ( ) . is_empty ( )
888
- }
889
-
890
885
if let ExprKind :: Call ( ref fun, _) = expr. kind {
891
886
if let ExprKind :: Path ( ref qp) = fun. kind {
892
887
let res = cx. qpath_res ( qp, fun. hir_id ) ;
893
888
return match res {
894
889
def:: Res :: Def ( DefKind :: Variant | DefKind :: Ctor ( ..) , ..) => true ,
895
- // FIXME: check the constness of the arguments, see https://github.com/rust-lang/rust-clippy/pull/5682#issuecomment-638681210
896
- def:: Res :: Def ( DefKind :: Fn , def_id) if has_no_arguments ( cx, def_id) => {
897
- const_eval:: is_const_fn ( cx. tcx , def_id)
898
- } ,
899
890
def:: Res :: Def ( _, def_id) => cx. tcx . is_promotable_const_fn ( def_id) ,
900
891
_ => false ,
901
892
} ;
0 commit comments