Skip to content

Commit 82fbdaa

Browse files
committed
rename to suspicious_double_ref_op and fix CI
1 parent 0dbc32d commit 82fbdaa

File tree

20 files changed

+32
-33
lines changed

20 files changed

+32
-33
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ fn link_dwarf_object<'a>(
573573

574574
impl<Relocations> ThorinSession<Relocations> {
575575
fn alloc_mmap(&self, data: Mmap) -> &Mmap {
576-
(*self.arena_mmap.alloc(data)).borrow()
576+
&*self.arena_mmap.alloc(data)
577577
}
578578
}
579579

@@ -583,7 +583,7 @@ fn link_dwarf_object<'a>(
583583
}
584584

585585
fn alloc_relocation(&self, data: Relocations) -> &Relocations {
586-
(*self.arena_relocations.alloc(data)).borrow()
586+
&*self.arena_relocations.alloc(data)
587587
}
588588

589589
fn read_input(&self, path: &Path) -> std::io::Result<&[u8]> {

compiler/rustc_lint/messages.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ lint_array_into_iter =
55
.use_explicit_into_iter_suggestion =
66
or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value
77
8-
lint_clone_double_ref =
8+
lint_suspicious_double_ref_op =
99
using `.{$call}()` on a double reference, which copies `{$ty}` instead of {$op} the inner type
1010
1111
lint_enum_intrinsics_mem_discriminant =

compiler/rustc_lint/src/lints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ pub struct BuiltinUnexpectedCliConfigValue {
565565
}
566566

567567
#[derive(LintDiagnostic)]
568-
#[diag(lint_clone_double_ref)]
568+
#[diag(lint_suspicious_double_ref_op)]
569569
pub struct CloneDoubleRef<'a> {
570570
pub call: Symbol,
571571
pub ty: Ty<'a>,

compiler/rustc_lint/src/noop_method_call.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ declare_lint! {
3737
}
3838

3939
declare_lint! {
40-
/// The `clone_double_ref` lint checks for usage of `.clone()` on an `&&T`,
40+
/// The `suspicious_double_ref_op` lint checks for usage of `.clone()` on an `&&T`,
4141
/// which copies the inner `&T`, instead of cloning the underlying `T` and
4242
/// can be confusing.
43-
pub CLONE_DOUBLE_REF,
43+
pub SUSPICIOUS_DOUBLE_REF_OP,
4444
Warn,
4545
"using `clone` on `&&T`"
4646
}
4747

48-
declare_lint_pass!(NoopMethodCall => [NOOP_METHOD_CALL, CLONE_DOUBLE_REF]);
48+
declare_lint_pass!(NoopMethodCall => [NOOP_METHOD_CALL, SUSPICIOUS_DOUBLE_REF_OP]);
4949

5050
impl<'tcx> LateLintPass<'tcx> for NoopMethodCall {
5151
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
@@ -115,7 +115,7 @@ impl<'tcx> LateLintPass<'tcx> for NoopMethodCall {
115115
);
116116
} else {
117117
cx.emit_spanned_lint(
118-
CLONE_DOUBLE_REF,
118+
SUSPICIOUS_DOUBLE_REF_OP,
119119
span,
120120
CloneDoubleRef { call: call.ident.name, ty: expr_ty, op },
121121
)

compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ use rustc_span::def_id::LocalDefId;
3939
use rustc_span::symbol::{sym, Ident, Symbol};
4040
use rustc_span::{BytePos, DesugaringKind, ExpnKind, MacroKind, Span, DUMMY_SP};
4141
use rustc_target::spec::abi;
42-
use std::ops::Deref;
4342

4443
use super::method_chain::CollectAllMismatches;
4544
use super::InferCtxtPrivExt;
@@ -3571,7 +3570,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
35713570
// trait_pred `S: Sum<<Self as Iterator>::Item>` and predicate `i32: Sum<&()>`
35723571
let mut type_diffs = vec![];
35733572

3574-
if let ObligationCauseCode::ExprBindingObligation(def_id, _, _, idx) = parent_code.deref()
3573+
if let ObligationCauseCode::ExprBindingObligation(def_id, _, _, idx) = parent_code
35753574
&& let Some(node_substs) = typeck_results.node_substs_opt(call_hir_id)
35763575
&& let where_clauses = self.tcx.predicates_of(def_id).instantiate(self.tcx, node_substs)
35773576
&& let Some(where_pred) = where_clauses.predicates.get(*idx)

library/core/benches/iter.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use core::borrow::Borrow;
21
use core::iter::*;
32
use core::mem;
43
use core::num::Wrapping;
@@ -428,7 +427,7 @@ fn bench_trusted_random_access_chunks(b: &mut Bencher) {
428427
black_box(&v)
429428
.iter()
430429
// this shows that we're not relying on the slice::Iter specialization in Copied
431-
.map(|b| *b.borrow())
430+
.map(|b| *b)
432431
.array_chunks::<{ mem::size_of::<u64>() }>()
433432
.map(|ary| {
434433
let d = u64::from_ne_bytes(ary);

library/core/tests/clone.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#[test]
2+
#[cfg_attr(not(bootstrap), allow(suspicious_double_ref_op))]
23
fn test_borrowed_clone() {
34
let x = 5;
45
let y: &i32 = &x;

src/tools/clippy/clippy_lints/src/renamed_lints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub static RENAMED_LINTS: &[(&str, &str)] = &[
3030
("clippy::stutter", "clippy::module_name_repetitions"),
3131
("clippy::to_string_in_display", "clippy::recursive_format_impl"),
3232
("clippy::zero_width_space", "clippy::invisible_characters"),
33-
("clippy::clone_double_ref", "clone_double_ref"),
33+
("clippy::clone_double_ref", "suspicious_double_ref_op"),
3434
("clippy::drop_bounds", "drop_bounds"),
3535
("clippy::for_loop_over_option", "for_loops_over_fallibles"),
3636
("clippy::for_loop_over_result", "for_loops_over_fallibles"),

src/tools/clippy/tests/ui/explicit_deref_methods.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#![warn(clippy::explicit_deref_methods)]
33
#![allow(unused_variables)]
44
#![allow(
5+
noop_method_call,
56
clippy::borrow_deref_ref,
6-
clone_double_ref,
77
clippy::explicit_auto_deref,
88
clippy::needless_borrow,
99
clippy::uninlined_format_args

src/tools/clippy/tests/ui/explicit_deref_methods.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#![warn(clippy::explicit_deref_methods)]
33
#![allow(unused_variables)]
44
#![allow(
5+
noop_method_call,
56
clippy::borrow_deref_ref,
6-
clone_double_ref,
77
clippy::explicit_auto_deref,
88
clippy::needless_borrow,
99
clippy::uninlined_format_args

0 commit comments

Comments
 (0)