1
Fork 0

Allow ambiguous_wide_pointer_comparisons lint for std methods

This commit is contained in:
Urgau 2023-11-10 10:16:29 +01:00
parent 6856a86808
commit 30c7b18d25
4 changed files with 14 additions and 0 deletions

View file

@ -1765,6 +1765,7 @@ impl<T> *const [T] {
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized> PartialEq for *const T {
#[inline]
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
fn eq(&self, other: &*const T) -> bool {
*self == *other
}
@ -1777,6 +1778,7 @@ impl<T: ?Sized> Eq for *const T {}
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized> Ord for *const T {
#[inline]
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
fn cmp(&self, other: &*const T) -> Ordering {
if self < other {
Less
@ -1796,21 +1798,25 @@ impl<T: ?Sized> PartialOrd for *const T {
}
#[inline]
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
fn lt(&self, other: &*const T) -> bool {
*self < *other
}
#[inline]
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
fn le(&self, other: &*const T) -> bool {
*self <= *other
}
#[inline]
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
fn gt(&self, other: &*const T) -> bool {
*self > *other
}
#[inline]
#[cfg_attr(not(bootstrap), allow(ambiguous_wide_pointer_comparisons))]
fn ge(&self, other: &*const T) -> bool {
*self >= *other
}