[Clippy] Swap manual_strip to use diagnostic items instead of paths · qinheping/verify-rust-std@9edfe1d (original) (raw)

Original file line number Diff line number Diff line change
@@ -134,6 +134,7 @@ impl str {
134 134 /// ```
135 135 #[stable(feature = "rust1", since = "1.0.0")]
136 136 #[rustc_const_stable(feature = "const_str_len", since = "1.39.0")]
137 +#[cfg_attr(not(test), rustc_diagnostic_item = "str_len")]
137 138 #[must_use]
138 139 #[inline]
139 140 pub const fn len(&self) -> usize {
@@ -1157,6 +1158,7 @@ impl str {
1157 1158 /// assert!(bananas.starts_with(&['a', 'b', 'c', 'd']));
1158 1159 /// ```
1159 1160 #[stable(feature = "rust1", since = "1.0.0")]
1161 +#[cfg_attr(not(test), rustc_diagnostic_item = "str_starts_with")]
1160 1162 pub fn starts_with<P: Pattern>(&self, pat: P) -> bool {
1161 1163 pat.is_prefix_of(self)
1162 1164 }
@@ -1181,6 +1183,7 @@ impl str {
1181 1183 /// assert!(!bananas.ends_with("nana"));
1182 1184 /// ```
1183 1185 #[stable(feature = "rust1", since = "1.0.0")]
1186 +#[cfg_attr(not(test), rustc_diagnostic_item = "str_ends_with")]
1184 1187 pub fn ends_with<P: Pattern>(&self, pat: P) -> bool
1185 1188 where
1186 1189 for<'a> P::Searcher<'a>: ReverseSearcher<'a>,