Skip to content

Commit 102e63b

Browse files
authored
Rollup merge of rust-lang#137214 - cyrgani:clippy_diagnostic_items, r=compiler-errors
add last std diagnostic items for clippy Part of rust-lang/rust-clippy#5393. Add diagnostic item attributes to the items in `std` and `core` where clippy currently uses hardcoded paths (https://github.com/rust-lang/rust-clippy/blob/master/clippy_utils/src/paths.rs).
2 parents 5b72eaa + 1eb38ed commit 102e63b

File tree

4 files changed

+7
-0
lines changed

4 files changed

+7
-0
lines changed

Diff for: core/src/char/methods.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1168,6 +1168,7 @@ impl char {
11681168
#[must_use]
11691169
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
11701170
#[rustc_const_stable(feature = "const_char_is_ascii", since = "1.32.0")]
1171+
#[cfg_attr(not(test), rustc_diagnostic_item = "char_is_ascii")]
11711172
#[inline]
11721173
pub const fn is_ascii(&self) -> bool {
11731174
*self as u32 <= 0x7F

Diff for: std/src/io/stdio.rs

+1
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ fn handle_ebadf_lazy<T>(r: io::Result<T>, default: impl FnOnce() -> T) -> io::Re
239239
/// }
240240
/// ```
241241
#[stable(feature = "rust1", since = "1.0.0")]
242+
#[cfg_attr(not(test), rustc_diagnostic_item = "Stdin")]
242243
pub struct Stdin {
243244
inner: &'static Mutex<BufReader<StdinRaw>>,
244245
}

Diff for: std/src/panic.rs

+1
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ pub use crate::panicking::{set_hook, take_hook};
255255
#[stable(feature = "panic_any", since = "1.51.0")]
256256
#[inline]
257257
#[track_caller]
258+
#[cfg_attr(not(test), rustc_diagnostic_item = "panic_any")]
258259
pub fn panic_any<M: 'static + Any + Send>(msg: M) -> ! {
259260
crate::panicking::begin_panic(msg);
260261
}

Diff for: std/src/process.rs

+4
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ use crate::{fmt, fs, str};
217217
///
218218
/// [`wait`]: Child::wait
219219
#[stable(feature = "process", since = "1.0.0")]
220+
#[cfg_attr(not(test), rustc_diagnostic_item = "Child")]
220221
pub struct Child {
221222
pub(crate) handle: imp::Process,
222223

@@ -2115,6 +2116,7 @@ impl Child {
21152116
/// [`ErrorKind`]: io::ErrorKind
21162117
/// [`InvalidInput`]: io::ErrorKind::InvalidInput
21172118
#[stable(feature = "process", since = "1.0.0")]
2119+
#[cfg_attr(not(test), rustc_diagnostic_item = "child_kill")]
21182120
pub fn kill(&mut self) -> io::Result<()> {
21192121
self.handle.kill()
21202122
}
@@ -2135,6 +2137,7 @@ impl Child {
21352137
/// ```
21362138
#[must_use]
21372139
#[stable(feature = "process_id", since = "1.3.0")]
2140+
#[cfg_attr(not(test), rustc_diagnostic_item = "child_id")]
21382141
pub fn id(&self) -> u32 {
21392142
self.handle.id()
21402143
}
@@ -2375,6 +2378,7 @@ pub fn exit(code: i32) -> ! {
23752378
/// [panic hook]: crate::panic::set_hook
23762379
#[stable(feature = "process_abort", since = "1.17.0")]
23772380
#[cold]
2381+
#[cfg_attr(not(test), rustc_diagnostic_item = "process_abort")]
23782382
pub fn abort() -> ! {
23792383
crate::sys::abort_internal();
23802384
}

0 commit comments

Comments
 (0)