From: Matthias Krüger Date: Sat, 17 Jul 2021 07:13:08 +0000 (+0200) Subject: don't slice slices (clippy::redundant_slicing) X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=a75192bcfe2d1a4a639d703b7b3271f857bec7b7;p=rust.git don't slice slices (clippy::redundant_slicing) --- diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 08499cef33e..fe33018df28 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -488,7 +488,7 @@ fn print<'a, 'tcx: 'a>( let cache = &cx.cache(); let relative_to = &cx.current; fn to_module_fqp(shortty: ItemType, fqp: &[String]) -> &[String] { - if shortty == ItemType::Module { &fqp[..] } else { &fqp[..fqp.len() - 1] } + if shortty == ItemType::Module { fqp } else { &fqp[..fqp.len() - 1] } } if !did.is_local() && !cache.access_levels.is_public(did) && !cache.document_private { @@ -509,7 +509,7 @@ fn to_module_fqp(shortty: ItemType, fqp: &[String]) -> &[String] { match cache.extern_locations[&did.krate] { ExternalLocation::Remote(ref s) => { let s = s.trim_end_matches('/'); - let mut s = vec![&s[..]]; + let mut s = vec![s]; s.extend(module_fqp[..].iter().map(String::as_str)); s }