Skip to content

Commit b5b6607

Browse files
committed
Uplift clippy::invalid_utf8_in_unchecked as invalid_from_utf8_unchecked
1 parent 00c8dc4 commit b5b6607

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

core/src/str/converts.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ pub const fn from_utf8_mut(v: &mut [u8]) -> Result<&mut str, Utf8Error> {
167167
#[must_use]
168168
#[stable(feature = "rust1", since = "1.0.0")]
169169
#[rustc_const_stable(feature = "const_str_from_utf8_unchecked", since = "1.55.0")]
170+
#[rustc_diagnostic_item = "str_from_utf8_unchecked"]
170171
pub const unsafe fn from_utf8_unchecked(v: &[u8]) -> &str {
171172
// SAFETY: the caller must guarantee that the bytes `v` are valid UTF-8.
172173
// Also relies on `&str` and `&[u8]` having the same layout.
@@ -194,6 +195,7 @@ pub const unsafe fn from_utf8_unchecked(v: &[u8]) -> &str {
194195
#[must_use]
195196
#[stable(feature = "str_mut_extras", since = "1.20.0")]
196197
#[rustc_const_unstable(feature = "const_str_from_utf8_unchecked_mut", issue = "91005")]
198+
#[rustc_diagnostic_item = "str_from_utf8_unchecked_mut"]
197199
pub const unsafe fn from_utf8_unchecked_mut(v: &mut [u8]) -> &mut str {
198200
// SAFETY: the caller must guarantee that the bytes `v`
199201
// are valid UTF-8, thus the cast to `*mut str` is safe.

0 commit comments

Comments
 (0)