Skip to content

Commit b1fe7c0

Browse files
committed
rename to borrow_deref_ref
1 parent b28f8ef commit b1fe7c0

11 files changed

+18
-18
lines changed

CHANGELOG.md

+1-1
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
@@ -3030,7 +3031,6 @@ Released 2018-09-13
30303031
[`needless_borrowed_reference`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowed_reference
30313032
[`needless_collect`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_collect
30323033
[`needless_continue`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_continue
3033-
[`needless_deref`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_deref
30343034
[`needless_doctest_main`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_doctest_main
30353035
[`needless_for_each`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_for_each
30363036
[`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

+5-5
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

+1-1
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),
@@ -205,7 +206,6 @@ store.register_group(true, "clippy::all", Some("clippy_all"), vec![
205206
LintId::of(needless_bool::NEEDLESS_BOOL),
206207
LintId::of(needless_borrow::NEEDLESS_BORROW),
207208
LintId::of(needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE),
208-
LintId::of(needless_deref::NEEDLESS_DEREF),
209209
LintId::of(needless_option_as_deref::NEEDLESS_OPTION_AS_DEREF),
210210
LintId::of(needless_question_mark::NEEDLESS_QUESTION_MARK),
211211
LintId::of(needless_update::NEEDLESS_UPDATE),

clippy_lints/src/lib.register_complexity.rs

+1-1
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),
@@ -55,7 +56,6 @@ store.register_group(true, "clippy::complexity", Some("clippy_complexity"), vec!
5556
LintId::of(needless_bool::BOOL_COMPARISON),
5657
LintId::of(needless_bool::NEEDLESS_BOOL),
5758
LintId::of(needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE),
58-
LintId::of(needless_deref::NEEDLESS_DEREF),
5959
LintId::of(needless_option_as_deref::NEEDLESS_OPTION_AS_DEREF),
6060
LintId::of(needless_question_mark::NEEDLESS_QUESTION_MARK),
6161
LintId::of(needless_update::NEEDLESS_UPDATE),

clippy_lints/src/lib.register_lints.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ store.register_lints(&[
5555
bool_assert_comparison::BOOL_ASSERT_COMPARISON,
5656
booleans::LOGIC_BUG,
5757
booleans::NONMINIMAL_BOOL,
58+
borrow_deref_ref::BORROW_DEREF_REF,
5859
bytecount::NAIVE_BYTECOUNT,
5960
cargo_common_metadata::CARGO_COMMON_METADATA,
6061
case_sensitive_file_extension_comparisons::CASE_SENSITIVE_FILE_EXTENSION_COMPARISONS,
@@ -355,7 +356,6 @@ store.register_lints(&[
355356
needless_borrow::REF_BINDING_TO_REFERENCE,
356357
needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE,
357358
needless_continue::NEEDLESS_CONTINUE,
358-
needless_deref::NEEDLESS_DEREF,
359359
needless_for_each::NEEDLESS_FOR_EACH,
360360
needless_option_as_deref::NEEDLESS_OPTION_AS_DEREF,
361361
needless_pass_by_value::NEEDLESS_PASS_BY_VALUE,

clippy_lints/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ mod blacklisted_name;
171171
mod blocks_in_if_conditions;
172172
mod bool_assert_comparison;
173173
mod booleans;
174+
mod borrow_deref_ref;
174175
mod bytecount;
175176
mod cargo_common_metadata;
176177
mod case_sensitive_file_extension_comparisons;
@@ -293,7 +294,6 @@ mod needless_bool;
293294
mod needless_borrow;
294295
mod needless_borrowed_ref;
295296
mod needless_continue;
296-
mod needless_deref;
297297
mod needless_for_each;
298298
mod needless_option_as_deref;
299299
mod needless_pass_by_value;
@@ -580,7 +580,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
580580
store.register_late_pass(|| Box::new(needless_update::NeedlessUpdate));
581581
store.register_late_pass(|| Box::new(needless_borrow::NeedlessBorrow::default()));
582582
store.register_late_pass(|| Box::new(needless_borrowed_ref::NeedlessBorrowedRef));
583-
store.register_late_pass(|| Box::new(needless_deref::NeedlessDeref));
583+
store.register_late_pass(|| Box::new(borrow_deref_ref::BorrowDerefRef));
584584
store.register_late_pass(|| Box::new(no_effect::NoEffect));
585585
store.register_late_pass(|| Box::new(temporary_assignment::TemporaryAssignment));
586586
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

+4-4
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

+1-1
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

+1-1
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

+1-1
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)