@@ -46,7 +46,6 @@ use rustc_lint::{LateContext, Level, Lint, LintContext};
4646use rustc_middle:: hir:: map:: Map ;
4747use rustc_middle:: ty:: subst:: { GenericArg , GenericArgKind } ;
4848use rustc_middle:: ty:: { self , layout:: IntegerExt , Ty , TyCtxt , TypeFoldable } ;
49- use rustc_mir:: const_eval;
5049use rustc_span:: hygiene:: { ExpnKind , MacroKind } ;
5150use rustc_span:: source_map:: original_sp;
5251use rustc_span:: symbol:: { self , kw, Symbol } ;
@@ -883,19 +882,11 @@ pub fn is_copy<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> bool {
883882
884883/// Checks if an expression is constructing a tuple-like enum variant or struct
885884pub 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-
890885 if let ExprKind :: Call ( ref fun, _) = expr. kind {
891886 if let ExprKind :: Path ( ref qp) = fun. kind {
892887 let res = cx. qpath_res ( qp, fun. hir_id ) ;
893888 return match res {
894889 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- } ,
899890 def:: Res :: Def ( _, def_id) => cx. tcx . is_promotable_const_fn ( def_id) ,
900891 _ => false ,
901892 } ;
0 commit comments