Skip to content

Commit 6d22567

Browse files
committed
dogfood
1 parent c3b7c8e commit 6d22567

File tree

6 files changed

+10
-11
lines changed

6 files changed

+10
-11
lines changed

clippy_lints/src/matches/match_bool.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ pub(crate) fn check(cx: &LateContext<'_>, ex: &Expr<'_>, arms: &[Arm<'_>], expr:
2424
let exprs = if let PatKind::Lit(arm_bool) = arms[0].pat.kind {
2525
if let ExprKind::Lit(ref lit) = arm_bool.kind {
2626
match lit.node {
27-
LitKind::Bool(true) => Some((&*arms[0].body, &*arms[1].body)),
28-
LitKind::Bool(false) => Some((&*arms[1].body, &*arms[0].body)),
27+
LitKind::Bool(true) => Some((arms[0].body, arms[1].body)),
28+
LitKind::Bool(false) => Some((arms[1].body, arms[0].body)),
2929
_ => None,
3030
}
3131
} else {

clippy_lints/src/methods/unnecessary_to_owned.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ fn is_cloned_or_copied(cx: &LateContext<'_>, method_name: Symbol, method_def_id:
415415
/// Returns true if the named method can be used to convert the receiver to its "owned"
416416
/// representation.
417417
fn is_to_owned_like(cx: &LateContext<'_>, method_name: Symbol, method_def_id: DefId) -> bool {
418-
is_clone_like(cx, &*method_name.as_str(), method_def_id)
418+
is_clone_like(cx, method_name.as_str(), method_def_id)
419419
|| is_cow_into_owned(cx, method_name, method_def_id)
420420
|| is_to_string(cx, method_name, method_def_id)
421421
}

clippy_lints/src/panic_in_result_fn.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ fn lint_impl_body<'tcx>(cx: &LateContext<'tcx>, impl_span: Span, body: &'tcx hir
6161
expr_visitor_no_bodies(|expr| {
6262
let Some(macro_call) = root_macro_call_first_node(cx, expr) else { return true };
6363
if matches!(
64-
&*cx.tcx.item_name(macro_call.def_id).as_str(),
64+
cx.tcx.item_name(macro_call.def_id).as_str(),
6565
"unimplemented" | "unreachable" | "panic" | "todo" | "assert" | "assert_eq" | "assert_ne"
6666
) {
6767
panics.push(macro_call.span);

clippy_lints/src/size_of_in_element_count.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ fn get_pointee_ty_and_count_expr<'tcx>(
110110
// Find calls to copy_{from,to}{,_nonoverlapping} and write_bytes methods
111111
if let ExprKind::MethodCall(method_path, [ptr_self, .., count], _) = expr.kind;
112112
let method_ident = method_path.ident.as_str();
113-
if METHODS.iter().any(|m| *m == &*method_ident);
113+
if METHODS.iter().any(|m| *m == method_ident);
114114

115115
// Get the pointee type
116116
if let ty::RawPtr(TypeAndMut { ty: pointee_ty, .. }) =

clippy_lints/src/utils/internal_lints.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ impl<'tcx> LateLintPass<'tcx> for LintWithoutLintPass {
422422
}
423423
} else if let Some(macro_call) = root_macro_call_first_node(cx, item) {
424424
if !matches!(
425-
&*cx.tcx.item_name(macro_call.def_id).as_str(),
425+
cx.tcx.item_name(macro_call.def_id).as_str(),
426426
"impl_lint_pass" | "declare_lint_pass"
427427
) {
428428
return;
@@ -504,7 +504,7 @@ fn check_invalid_clippy_version_attribute(cx: &LateContext<'_>, item: &'_ Item<'
504504
return;
505505
}
506506

507-
if RustcVersion::parse(&*value.as_str()).is_err() {
507+
if RustcVersion::parse(value.as_str()).is_err() {
508508
span_lint_and_help(
509509
cx,
510510
INVALID_CLIPPY_VERSION_ATTRIBUTE,
@@ -595,7 +595,7 @@ impl<'tcx> LateLintPass<'tcx> for CompilerLintFunctions {
595595
if_chain! {
596596
if let ExprKind::MethodCall(path, [self_arg, ..], _) = &expr.kind;
597597
let fn_name = path.ident;
598-
if let Some(sugg) = self.map.get(&*fn_name.as_str());
598+
if let Some(sugg) = self.map.get(fn_name.as_str());
599599
let ty = cx.typeck_results().expr_ty(self_arg).peel_refs();
600600
if match_type(cx, ty, &paths::EARLY_CONTEXT)
601601
|| match_type(cx, ty, &paths::LATE_CONTEXT);
@@ -679,7 +679,7 @@ impl<'tcx> LateLintPass<'tcx> for CollapsibleCalls {
679679
then {
680680
let and_then_snippets = get_and_then_snippets(cx, and_then_args);
681681
let mut sle = SpanlessEq::new(cx).deny_side_effects();
682-
match &*ps.ident.as_str() {
682+
match ps.ident.as_str() {
683683
"span_suggestion" if sle.eq_expr(&and_then_args[2], &span_call_args[1]) => {
684684
suggest_suggestion(cx, expr, &and_then_snippets, &span_suggestion_snippets(cx, span_call_args));
685685
},

clippy_lints/src/utils/internal_lints/metadata_collector.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -527,12 +527,11 @@ fn extract_attr_docs_or_lint(cx: &LateContext<'_>, item: &Item<'_>) -> Option<St
527527
fn extract_attr_docs(cx: &LateContext<'_>, item: &Item<'_>) -> Option<String> {
528528
let attrs = cx.tcx.hir().attrs(item.hir_id());
529529
let mut lines = attrs.iter().filter_map(ast::Attribute::doc_str);
530-
let mut docs = String::from(&*lines.next()?.as_str());
530+
let mut docs = String::from(lines.next()?.as_str());
531531
let mut in_code_block = false;
532532
let mut is_code_block_rust = false;
533533
for line in lines {
534534
let line = line.as_str();
535-
let line = &*line;
536535

537536
// Rustdoc hides code lines starting with `# ` and this removes them from Clippy's lint list :)
538537
if is_code_block_rust && line.trim_start().starts_with("# ") {

0 commit comments

Comments
 (0)