Skip to content

Commit 3cc67d0

Browse files
committed
Relax clippy_utils::consts::miri_to_const pointer type restrictiveness
1 parent 6afe547 commit 3cc67d0

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

clippy_lints/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ mod explicit_write;
125125
mod fallible_impl_from;
126126
mod float_literal;
127127
mod floating_point_arithmetic;
128+
mod fn_null_check;
128129
mod format;
129130
mod format_args;
130131
mod format_impl;
@@ -902,6 +903,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
902903
store.register_late_pass(|_| Box::new(suspicious_xor_used_as_pow::ConfusingXorAndPow));
903904
store.register_late_pass(move |_| Box::new(manual_is_ascii_check::ManualIsAsciiCheck::new(msrv())));
904905
store.register_late_pass(|_| Box::new(semicolon_block::SemicolonBlock));
906+
store.register_late_pass(|_| Box::new(fn_null_check::FnNullCheck));
905907
// add lints here, do not remove this comment, it's used in `new_lint`
906908
}
907909

clippy_utils/src/consts.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -620,12 +620,7 @@ pub fn miri_to_const<'tcx>(tcx: TyCtxt<'tcx>, result: mir::ConstantKind<'tcx>) -
620620
ty::Float(FloatTy::F64) => Some(Constant::F64(f64::from_bits(
621621
int.try_into().expect("invalid f64 bit representation"),
622622
))),
623-
ty::RawPtr(type_and_mut) => {
624-
if let ty::Uint(_) = type_and_mut.ty.kind() {
625-
return Some(Constant::RawPtr(int.assert_bits(int.size())));
626-
}
627-
None
628-
},
623+
ty::RawPtr(_) => Some(Constant::RawPtr(int.assert_bits(int.size()))),
629624
// FIXME: implement other conversions.
630625
_ => None,
631626
}

0 commit comments

Comments
 (0)