]> git.lizzy.rs Git - rust.git/commitdiff
don't slice slices (clippy::redundant_slicing)
authorMatthias Krüger <matthias.krueger@famsik.de>
Sat, 17 Jul 2021 07:13:08 +0000 (09:13 +0200)
committerMatthias Krüger <matthias.krueger@famsik.de>
Sun, 25 Jul 2021 10:19:33 +0000 (12:19 +0200)
src/librustdoc/html/format.rs

index 08499cef33ef19cb23564159e605f7408587341c..fe33018df28eac76c2e01ba66f7999ecd73a9c4b 100644 (file)
@@ -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
                         }