diff options
| author | Guillaume Gomez <guillaume.gomez@huawei.com> | 2024-08-29 12:14:34 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2024-08-29 12:14:41 +0200 |
| commit | 8683439a20b7bbb96a23751b9010b139809cb236 (patch) | |
| tree | 16f066c7586f2991017214f5a3b4e95caa40fc18 /src/librustdoc/clean/utils.rs | |
| parent | a60a9e567a7319b33619f6551dc29522c6f58687 (diff) | |
| download | rust-8683439a20b7bbb96a23751b9010b139809cb236.tar.gz rust-8683439a20b7bbb96a23751b9010b139809cb236.zip | |
Fix clippy lints
Diffstat (limited to 'src/librustdoc/clean/utils.rs')
| -rw-r--r-- | src/librustdoc/clean/utils.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs index 68266f3506a..d826171aa61 100644 --- a/src/librustdoc/clean/utils.rs +++ b/src/librustdoc/clean/utils.rs @@ -321,9 +321,9 @@ pub(crate) fn name_from_pat(p: &hir::Pat<'_>) -> Symbol { "({})", elts.iter().map(|p| name_from_pat(p).to_string()).collect::<Vec<String>>().join(", ") ), - PatKind::Box(p) => return name_from_pat(&*p), - PatKind::Deref(p) => format!("deref!({})", name_from_pat(&*p)), - PatKind::Ref(p, _) => return name_from_pat(&*p), + PatKind::Box(p) => return name_from_pat(p), + PatKind::Deref(p) => format!("deref!({})", name_from_pat(p)), + PatKind::Ref(p, _) => return name_from_pat(p), PatKind::Lit(..) => { warn!( "tried to get argument name from PatKind::Lit, which is silly in function arguments" @@ -333,7 +333,7 @@ pub(crate) fn name_from_pat(p: &hir::Pat<'_>) -> Symbol { PatKind::Range(..) => return kw::Underscore, PatKind::Slice(begin, ref mid, end) => { let begin = begin.iter().map(|p| name_from_pat(p).to_string()); - let mid = mid.as_ref().map(|p| format!("..{}", name_from_pat(&**p))).into_iter(); + let mid = mid.as_ref().map(|p| format!("..{}", name_from_pat(p))).into_iter(); let end = end.iter().map(|p| name_from_pat(p).to_string()); format!("[{}]", begin.chain(mid).chain(end).collect::<Vec<_>>().join(", ")) } @@ -344,7 +344,7 @@ pub(crate) fn print_const(cx: &DocContext<'_>, n: ty::Const<'_>) -> String { match n.kind() { ty::ConstKind::Unevaluated(ty::UnevaluatedConst { def, args: _ }) => { let s = if let Some(def) = def.as_local() { - rendered_const(cx.tcx, &cx.tcx.hir().body_owned_by(def), def) + rendered_const(cx.tcx, cx.tcx.hir().body_owned_by(def), def) } else { inline::print_inlined_const(cx.tcx, def) }; @@ -383,7 +383,7 @@ pub(crate) fn print_evaluated_const( fn format_integer_with_underscore_sep(num: &str) -> String { let num_chars: Vec<_> = num.chars().collect(); - let mut num_start_index = if num_chars.get(0) == Some(&'-') { 1 } else { 0 }; + let mut num_start_index = if num_chars.first() == Some(&'-') { 1 } else { 0 }; let chunk_size = match num[num_start_index..].as_bytes() { [b'0', b'b' | b'x', ..] => { num_start_index += 2; |
