[Clippy] Swap option_as_ref_deref to use diagnostic items instead o… · qinheping/verify-rust-std@6ef72c4 (original) (raw)

5 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -576,6 +576,7 @@ impl CString {
576 576 #[inline]
577 577 #[must_use]
578 578 #[stable(feature = "as_c_str", since = "1.20.0")]
579 +#[cfg_attr(not(test), rustc_diagnostic_item = "cstring_as_c_str")]
579 580 pub fn as_c_str(&self) -> &CStr {
580 581 &*self
581 582 }
Original file line number Diff line number Diff line change
@@ -1073,6 +1073,7 @@ impl String {
1073 1073 #[inline]
1074 1074 #[must_use]
1075 1075 #[stable(feature = "string_as_str", since = "1.7.0")]
1076 +#[cfg_attr(not(test), rustc_diagnostic_item = "string_as_str")]
1076 1077 pub fn as_str(&self) -> &str {
1077 1078 self
1078 1079 }
@@ -1092,6 +1093,7 @@ impl String {
1092 1093 #[inline]
1093 1094 #[must_use]
1094 1095 #[stable(feature = "string_as_str", since = "1.7.0")]
1096 +#[cfg_attr(not(test), rustc_diagnostic_item = "string_as_mut_str")]
1095 1097 pub fn as_mut_str(&mut self) -> &mut str {
1096 1098 self
1097 1099 }
Original file line number Diff line number Diff line change
@@ -1545,6 +1545,7 @@ impl<T, A: Allocator> Vec<T, A> {
1545 1545 /// ```
1546 1546 #[inline]
1547 1547 #[stable(feature = "vec_as_slice", since = "1.7.0")]
1548 +#[cfg_attr(not(test), rustc_diagnostic_item = "vec_as_slice")]
1548 1549 pub fn as_slice(&self) -> &[T] {
1549 1550 self
1550 1551 }
@@ -1562,6 +1563,7 @@ impl<T, A: Allocator> Vec<T, A> {
1562 1563 /// ```
1563 1564 #[inline]
1564 1565 #[stable(feature = "vec_as_slice", since = "1.7.0")]
1566 +#[cfg_attr(not(test), rustc_diagnostic_item = "vec_as_mut_slice")]
1565 1567 pub fn as_mut_slice(&mut self) -> &mut [T] {
1566 1568 self
1567 1569 }
Original file line number Diff line number Diff line change
@@ -196,6 +196,7 @@ impl OsString {
196 196 /// let os_str = OsStr::new("foo");
197 197 /// assert_eq!(os_string.as_os_str(), os_str);
198 198 /// ```
199 + #[cfg_attr(not(test), rustc_diagnostic_item = "os_string_as_os_str")]
199 200 #[stable(feature = "rust1", since = "1.0.0")]
200 201 #[must_use]
201 202 #[inline]
Original file line number Diff line number Diff line change
@@ -1226,6 +1226,7 @@ impl PathBuf {
1226 1226 /// let p = PathBuf::from("/test");
1227 1227 /// assert_eq!(Path::new("/test"), p.as_path());
1228 1228 /// ```
1229 + #[cfg_attr(not(test), rustc_diagnostic_item = "pathbuf_as_path")]
1229 1230 #[stable(feature = "rust1", since = "1.0.0")]
1230 1231 #[must_use]
1231 1232 #[inline]