@@ -24,6 +24,8 @@ mod verbose_bit_mask;
2424pub ( crate ) mod arithmetic_side_effects;
2525
2626use clippy_config:: Conf ;
27+ use clippy_utils:: def_path_def_ids;
28+ use rustc_hir:: def_id:: DefIdSet ;
2729use rustc_hir:: { Body , Expr , ExprKind , UnOp } ;
2830use rustc_lint:: { LateContext , LateLintPass } ;
2931use rustc_session:: impl_lint_pass;
@@ -774,9 +776,8 @@ declare_clippy_lint! {
774776 "explicit self-assignment"
775777}
776778
777- #[ derive( Clone , Copy ) ]
778779struct FloatCmpConfig {
779- ignore_named_constants : bool ,
780+ allowed_constants : DefIdSet ,
780781 ignore_constant_comparisons : bool ,
781782 ignore_change_detection : bool ,
782783}
@@ -794,7 +795,11 @@ impl Operators {
794795 verbose_bit_mask_threshold : conf. verbose_bit_mask_threshold ,
795796 modulo_arithmetic_allow_comparison_to_zero : conf. allow_comparison_to_zero ,
796797 float_cmp_config : FloatCmpConfig {
797- ignore_named_constants : conf. float_cmp_ignore_named_constants ,
798+ allowed_constants : conf
799+ . float_cmp_allowed_constants
800+ . iter ( )
801+ . flat_map ( |x| def_path_def_ids ( tcx, & x. split ( "::" ) . collect :: < Vec < _ > > ( ) ) )
802+ . collect ( ) ,
798803 ignore_constant_comparisons : conf. float_cmp_ignore_constant_comparisons ,
799804 ignore_change_detection : conf. float_cmp_ignore_change_detection ,
800805 } ,
0 commit comments