[Clippy] Swap unnecessary_to_owned to use diagnostic item instead o… · qinheping/verify-rust-std@995238c (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Commit 995238c

[Clippy] Swap unnecessary_to_owned to use diagnostic item instead of path

File tree

1 file changed

lines changed

1 file changed

lines changed

Original file line number Diff line number Diff line change
@@ -571,6 +571,7 @@ impl String {
571 571 /// [`into_bytes`]: String::into_bytes
572 572 #[inline]
573 573 #[stable(feature = "rust1", since = "1.0.0")]
574 +#[cfg_attr(not(test), rustc_diagnostic_item = "string_from_utf8")]
574 575 pub fn from_utf8(vec: Vec<u8>) -> Result<String, FromUtf8Error> {
575 576 match str::from_utf8(&vec) {
576 577 Ok(..) => Ok(String { vec }),