diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2021-01-02 11:29:07 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-02 11:29:07 +0000 |
| commit | 29c1bc97239d364cf63b0d3b59e474ee3d9ba5a9 (patch) | |
| tree | 46b6b98c000f77bee2471cc24947bf302ec414f9 /src/librustdoc/html/render/mod.rs | |
| parent | 5986dd878f3e432025eb1946149e3241d3998b1b (diff) | |
| parent | a5807ac61c82ca8c6768da0af04d76ceaf760c0a (diff) | |
| download | rust-29c1bc97239d364cf63b0d3b59e474ee3d9ba5a9.tar.gz rust-29c1bc97239d364cf63b0d3b59e474ee3d9ba5a9.zip | |
Rollup merge of #80546 - matthiaskrgr:rustdoclippy, r=LingMan
clippy fixes for librustdoc fixes clippy warnings of type: match_like_matches_macro or_fun_call op_ref needless_return let_and_return single_char_add_str useless_format unnecessary_sort_by match_ref_pats redundant_field_names
Diffstat (limited to 'src/librustdoc/html/render/mod.rs')
| -rw-r--r-- | src/librustdoc/html/render/mod.rs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index c19262b72cf..2f5ee4f238d 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -979,7 +979,7 @@ themePicker.onblur = handleThemeButtonsBlur; .iter() .map(|s| format!("\"{}\"", s.to_str().expect("invalid osstring conversion"))) .collect::<Vec<_>>(); - files.sort_unstable_by(|a, b| a.cmp(b)); + files.sort_unstable(); let subs = subs.iter().map(|s| s.to_json_string()).collect::<Vec<_>>().join(","); let dirs = if subs.is_empty() { String::new() } else { format!(",\"dirs\":[{}]", subs) }; @@ -1428,7 +1428,7 @@ impl Setting { .map(|opt| format!( "<option value=\"{}\" {}>{}</option>", opt.0, - if &opt.0 == default_value { "selected" } else { "" }, + if opt.0 == default_value { "selected" } else { "" }, opt.1, )) .collect::<String>(), @@ -1595,7 +1595,7 @@ impl Context<'_> { if let Some(&(ref names, ty)) = cache.paths.get(&it.def_id) { for name in &names[..names.len() - 1] { url.push_str(name); - url.push_str("/"); + url.push('/'); } url.push_str(&item_path(ty, names.last().unwrap())); layout::redirect(&url) @@ -2308,7 +2308,7 @@ fn short_item_info( let since = &since.as_str(); if !stability::deprecation_in_effect(is_since_rustc_version, Some(since)) { if *since == "TBD" { - format!("Deprecating in a future Rust version") + String::from("Deprecating in a future Rust version") } else { format!("Deprecating in {}", Escape(since)) } @@ -4323,9 +4323,11 @@ fn sidebar_assoc_items(it: &clean::Item) -> String { .any(|i| i.inner_impl().trait_.def_id() == c.deref_mut_trait_did); let inner_impl = target .def_id() - .or(target - .primitive_type() - .and_then(|prim| c.primitive_locations.get(&prim).cloned())) + .or_else(|| { + target + .primitive_type() + .and_then(|prim| c.primitive_locations.get(&prim).cloned()) + }) .and_then(|did| c.impls.get(&did)); if let Some(impls) = inner_impl { out.push_str("<a class=\"sidebar-title\" href=\"#deref-methods\">"); |
