]> git.lizzy.rs Git - rust.git/commitdiff
Added diagnostic items to functions for Clippy
authorxFrednet <xFrednet@gmail.com>
Thu, 15 Jul 2021 21:47:03 +0000 (23:47 +0200)
committerxFrednet <xFrednet@gmail.com>
Thu, 15 Jul 2021 21:47:03 +0000 (23:47 +0200)
compiler/rustc_span/src/symbol.rs
library/core/src/cmp.rs
library/core/src/iter/sources/repeat.rs
library/core/src/mem/mod.rs

index 9051c9d69b5c1e7b98dc5000ff5bd993f341b85b..944e896ba6fd5c02b48baa2403fac336d06fa173 100644 (file)
         closure,
         closure_to_fn_coercion,
         cmp,
+        cmp_max,
+        cmp_min,
         cmpxchg16b_target_feature,
         cmse_nonsecure_entry,
         coerce_unsized,
         item,
         item_like_imports,
         iter,
+        iter_repeat,
         keyword,
         kind,
         kreg,
         maybe_uninit,
         maybe_uninit_uninit,
         maybe_uninit_zeroed,
+        mem_discriminant,
+        mem_drop,
+        mem_forget,
+        mem_replace,
+        mem_size_of,
+        mem_size_of_val,
         mem_uninitialized,
         mem_zeroed,
         member_constraints,
index 879deed3bed5e63a11a9886723742f54f76a486f..79610bb409d37c06b383ea7622452560b179ebf6 100644 (file)
@@ -1104,6 +1104,7 @@ fn ge(&self, other: &Rhs) -> bool {
 #[inline]
 #[must_use]
 #[stable(feature = "rust1", since = "1.0.0")]
+#[cfg_attr(not(test), rustc_diagnostic_item = "cmp_min")]
 pub fn min<T: Ord>(v1: T, v2: T) -> T {
     v1.min(v2)
 }
@@ -1166,6 +1167,7 @@ pub fn min_by_key<T, F: FnMut(&T) -> K, K: Ord>(v1: T, v2: T, mut f: F) -> T {
 #[inline]
 #[must_use]
 #[stable(feature = "rust1", since = "1.0.0")]
+#[cfg_attr(not(test), rustc_diagnostic_item = "cmp_max")]
 pub fn max<T: Ord>(v1: T, v2: T) -> T {
     v1.max(v2)
 }
index a9478041c69c47f9783eebb8ebf8498d0714eea2..733142ed01103ce3e41806d56fecf1561a03d00a 100644 (file)
@@ -51,6 +51,7 @@
 /// ```
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
+#[cfg_attr(not(test), rustc_diagnostic_item = "iter_repeat")]
 pub fn repeat<T: Clone>(elt: T) -> Repeat<T> {
     Repeat { element: elt }
 }
index 5bf47c3951da22ff93397bf17e8abf315bf089c2..2c75de39ffa2fc3644cdf479786903e046788f7a 100644 (file)
 #[inline]
 #[rustc_const_stable(feature = "const_forget", since = "1.46.0")]
 #[stable(feature = "rust1", since = "1.0.0")]
+#[cfg_attr(not(test), rustc_diagnostic_item = "mem_forget")]
 pub const fn forget<T>(t: T) {
     let _ = ManuallyDrop::new(t);
 }
@@ -298,6 +299,7 @@ pub fn forget_unsized<T: ?Sized>(t: T) {
 #[stable(feature = "rust1", since = "1.0.0")]
 #[rustc_promotable]
 #[rustc_const_stable(feature = "const_size_of", since = "1.24.0")]
+#[cfg_attr(not(test), rustc_diagnostic_item = "mem_size_of")]
 pub const fn size_of<T>() -> usize {
     intrinsics::size_of::<T>()
 }
@@ -324,6 +326,7 @@ pub const fn size_of<T>() -> usize {
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
 #[rustc_const_unstable(feature = "const_size_of_val", issue = "46571")]
+#[cfg_attr(not(test), rustc_diagnostic_item = "mem_size_of_val")]
 pub const fn size_of_val<T: ?Sized>(val: &T) -> usize {
     // SAFETY: `val` is a reference, so it's a valid raw pointer
     unsafe { intrinsics::size_of_val(val) }
@@ -814,6 +817,7 @@ pub fn take<T: Default>(dest: &mut T) -> T {
 #[stable(feature = "rust1", since = "1.0.0")]
 #[must_use = "if you don't need the old value, you can just assign the new value directly"]
 #[rustc_const_unstable(feature = "const_replace", issue = "83164")]
+#[cfg_attr(not(test), rustc_diagnostic_item = "mem_replace")]
 pub const fn replace<T>(dest: &mut T, src: T) -> T {
     // SAFETY: We read from `dest` but directly write `src` into it afterwards,
     // such that the old value is not duplicated. Nothing is dropped and
@@ -888,6 +892,7 @@ pub const fn replace<T>(dest: &mut T, src: T) -> T {
 /// [`RefCell`]: crate::cell::RefCell
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
+#[cfg_attr(not(test), rustc_diagnostic_item = "mem_drop")]
 pub fn drop<T>(_x: T) {}
 
 /// Interprets `src` as having type `&U`, and then reads `src` without moving
@@ -1015,6 +1020,7 @@ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
 /// ```
 #[stable(feature = "discriminant_value", since = "1.21.0")]
 #[rustc_const_unstable(feature = "const_discriminant", issue = "69821")]
+#[cfg_attr(not(test), rustc_diagnostic_item = "mem_discriminant")]
 pub const fn discriminant<T>(v: &T) -> Discriminant<T> {
     Discriminant(intrinsics::discriminant_value(v))
 }