Skip to content

Commit 4082b45

Browse files
committed
rename to borrow_deref_ref
1 parent c4b2d0c commit 4082b45

11 files changed

+18
-18
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2773,6 +2773,7 @@ Released 2018-09-13
27732773
[`blocks_in_if_conditions`]: https://rust-lang.github.io/rust-clippy/master/index.html#blocks_in_if_conditions
27742774
[`bool_assert_comparison`]: https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison
27752775
[`bool_comparison`]: https://rust-lang.github.io/rust-clippy/master/index.html#bool_comparison
2776+
[`borrow_deref_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#borrow_deref_ref
27762777
[`borrow_interior_mutable_const`]: https://rust-lang.github.io/rust-clippy/master/index.html#borrow_interior_mutable_const
27772778
[`borrowed_box`]: https://rust-lang.github.io/rust-clippy/master/index.html#borrowed_box
27782779
[`box_collection`]: https://rust-lang.github.io/rust-clippy/master/index.html#box_collection
@@ -3031,7 +3032,6 @@ Released 2018-09-13
30313032
[`needless_borrowed_reference`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowed_reference
30323033
[`needless_collect`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_collect
30333034
[`needless_continue`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_continue
3034-
[`needless_deref`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_deref
30353035
[`needless_doctest_main`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_doctest_main
30363036
[`needless_for_each`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_for_each
30373037
[`needless_lifetimes`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes

clippy_lints/src/needless_deref.rs renamed to clippy_lints/src/borrow_deref_ref.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ declare_clippy_lint! {
4343
///
4444
/// fn foo(_: &str){ }
4545
/// ```
46-
pub NEEDLESS_DEREF,
46+
pub BORROW_DEREF_REF,
4747
complexity,
4848
"deref on an immutable reference returns the same type as itself"
4949
}
5050

51-
declare_lint_pass!(NeedlessDeref => [NEEDLESS_DEREF]);
51+
declare_lint_pass!(BorrowDerefRef => [BORROW_DEREF_REF]);
5252

53-
impl LateLintPass<'_> for NeedlessDeref {
53+
impl LateLintPass<'_> for BorrowDerefRef {
5454
fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &'tcx rustc_hir::Expr<'_>) {
5555
if_chain! {
5656
if !e.span.from_expansion();
@@ -101,7 +101,7 @@ impl LateLintPass<'_> for NeedlessDeref {
101101
if give_2_help {
102102
span_lint_and_then(
103103
cx,
104-
NEEDLESS_DEREF,
104+
BORROW_DEREF_REF,
105105
e.span,
106106
"deref on an immutable reference",
107107
|diag| {
@@ -122,7 +122,7 @@ impl LateLintPass<'_> for NeedlessDeref {
122122
}else {
123123
span_lint_and_help(
124124
cx,
125-
NEEDLESS_DEREF,
125+
BORROW_DEREF_REF,
126126
e.span,
127127
"deref on an immutable reference",
128128
None,

clippy_lints/src/lib.register_all.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ store.register_group(true, "clippy::all", Some("clippy_all"), vec![
2121
LintId::of(bool_assert_comparison::BOOL_ASSERT_COMPARISON),
2222
LintId::of(booleans::LOGIC_BUG),
2323
LintId::of(booleans::NONMINIMAL_BOOL),
24+
LintId::of(borrow_deref_ref::BORROW_DEREF_REF),
2425
LintId::of(casts::CAST_REF_TO_MUT),
2526
LintId::of(casts::CHAR_LIT_AS_U8),
2627
LintId::of(casts::FN_TO_NUMERIC_CAST),
@@ -206,7 +207,6 @@ store.register_group(true, "clippy::all", Some("clippy_all"), vec![
206207
LintId::of(needless_bool::BOOL_COMPARISON),
207208
LintId::of(needless_bool::NEEDLESS_BOOL),
208209
LintId::of(needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE),
209-
LintId::of(needless_deref::NEEDLESS_DEREF),
210210
LintId::of(needless_option_as_deref::NEEDLESS_OPTION_AS_DEREF),
211211
LintId::of(needless_question_mark::NEEDLESS_QUESTION_MARK),
212212
LintId::of(needless_update::NEEDLESS_UPDATE),

clippy_lints/src/lib.register_complexity.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
store.register_group(true, "clippy::complexity", Some("clippy_complexity"), vec![
66
LintId::of(attrs::DEPRECATED_CFG_ATTR),
77
LintId::of(booleans::NONMINIMAL_BOOL),
8+
LintId::of(borrow_deref_ref::BORROW_DEREF_REF),
89
LintId::of(casts::CHAR_LIT_AS_U8),
910
LintId::of(casts::UNNECESSARY_CAST),
1011
LintId::of(derivable_impls::DERIVABLE_IMPLS),
@@ -56,7 +57,6 @@ store.register_group(true, "clippy::complexity", Some("clippy_complexity"), vec!
5657
LintId::of(needless_bool::BOOL_COMPARISON),
5758
LintId::of(needless_bool::NEEDLESS_BOOL),
5859
LintId::of(needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE),
59-
LintId::of(needless_deref::NEEDLESS_DEREF),
6060
LintId::of(needless_option_as_deref::NEEDLESS_OPTION_AS_DEREF),
6161
LintId::of(needless_question_mark::NEEDLESS_QUESTION_MARK),
6262
LintId::of(needless_update::NEEDLESS_UPDATE),

clippy_lints/src/lib.register_lints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ store.register_lints(&[
5959
bool_assert_comparison::BOOL_ASSERT_COMPARISON,
6060
booleans::LOGIC_BUG,
6161
booleans::NONMINIMAL_BOOL,
62+
borrow_deref_ref::BORROW_DEREF_REF,
6263
bytecount::NAIVE_BYTECOUNT,
6364
cargo_common_metadata::CARGO_COMMON_METADATA,
6465
case_sensitive_file_extension_comparisons::CASE_SENSITIVE_FILE_EXTENSION_COMPARISONS,
@@ -361,7 +362,6 @@ store.register_lints(&[
361362
needless_bool::NEEDLESS_BOOL,
362363
needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE,
363364
needless_continue::NEEDLESS_CONTINUE,
364-
needless_deref::NEEDLESS_DEREF,
365365
needless_for_each::NEEDLESS_FOR_EACH,
366366
needless_option_as_deref::NEEDLESS_OPTION_AS_DEREF,
367367
needless_pass_by_value::NEEDLESS_PASS_BY_VALUE,

clippy_lints/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ mod blacklisted_name;
176176
mod blocks_in_if_conditions;
177177
mod bool_assert_comparison;
178178
mod booleans;
179+
mod borrow_deref_ref;
179180
mod bytecount;
180181
mod cargo_common_metadata;
181182
mod case_sensitive_file_extension_comparisons;
@@ -298,7 +299,6 @@ mod needless_bitwise_bool;
298299
mod needless_bool;
299300
mod needless_borrowed_ref;
300301
mod needless_continue;
301-
mod needless_deref;
302302
mod needless_for_each;
303303
mod needless_option_as_deref;
304304
mod needless_pass_by_value;
@@ -603,7 +603,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
603603
store.register_late_pass(|| Box::new(mutex_atomic::Mutex));
604604
store.register_late_pass(|| Box::new(needless_update::NeedlessUpdate));
605605
store.register_late_pass(|| Box::new(needless_borrowed_ref::NeedlessBorrowedRef));
606-
store.register_late_pass(|| Box::new(needless_deref::NeedlessDeref));
606+
store.register_late_pass(|| Box::new(borrow_deref_ref::BorrowDerefRef));
607607
store.register_late_pass(|| Box::new(no_effect::NoEffect));
608608
store.register_late_pass(|| Box::new(temporary_assignment::TemporaryAssignment));
609609
store.register_late_pass(|| Box::new(transmute::Transmute));
File renamed without changes.

tests/ui/needless_deref.stderr renamed to tests/ui/borrow_deref_ref.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
error: deref on an immutable reference
2-
--> $DIR/needless_deref.rs:6:23
2+
--> $DIR/borrow_deref_ref.rs:6:23
33
|
44
LL | let a: &str = &*s;
55
| ^^^
66
|
7-
= note: `-D clippy::needless-deref` implied by `-D warnings`
7+
= note: `-D clippy::borrow-deref-ref` implied by `-D warnings`
88
= help: consider using `&**s` if you would like to deref
99
= help: consider using `s` if you would like to reborrow
1010

1111
error: deref on an immutable reference
12-
--> $DIR/needless_deref.rs:9:22
12+
--> $DIR/borrow_deref_ref.rs:9:22
1313
|
1414
LL | let b = &mut &*bar(a);
1515
| ^^^^^^^^
1616
|
1717
= help: consider using `bar(a)` if you would like to reborrow
1818

1919
error: deref on an immutable reference
20-
--> $DIR/needless_deref.rs:59:23
20+
--> $DIR/borrow_deref_ref.rs:59:23
2121
|
2222
LL | let addr_y = &&*x as *const _ as usize; // assert ok
2323
| ^^^

tests/ui/explicit_deref_methods.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#![allow(unused_variables)]
44
#![allow(clippy::clone_double_ref)]
5-
#![allow(clippy::needless_deref)]
5+
#![allow(clippy::borrow_deref_ref)]
66
#![warn(clippy::explicit_deref_methods)]
77

88
use std::ops::{Deref, DerefMut};

tests/ui/explicit_deref_methods.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#![allow(unused_variables)]
44
#![allow(clippy::clone_double_ref)]
5-
#![allow(clippy::needless_deref)]
5+
#![allow(clippy::borrow_deref_ref)]
66
#![warn(clippy::explicit_deref_methods)]
77

88
use std::ops::{Deref, DerefMut};

tests/ui/forget_ref.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![warn(clippy::forget_ref)]
22
#![allow(clippy::toplevel_ref_arg)]
33
#![allow(clippy::unnecessary_wraps)]
4-
#![allow(clippy::needless_deref)]
4+
#![allow(clippy::borrow_deref_ref)]
55

66
use std::mem::forget;
77

0 commit comments

Comments
 (0)