Skip to content

Commit 6938380

Browse files
tommilliganThibsG
authored andcommitted
Renamed to explicit_deref_method and move to pedantic
1 parent e1523fb commit 6938380

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

clippy_lints/src/dereference.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use crate::rustc::hir::{Expr, ExprKind, QPath};
22
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
33
use crate::rustc::{declare_tool_lint, lint_array};
4-
use if_chain::if_chain;
54
use crate::utils::span_lint_and_sugg;
5+
use if_chain::if_chain;
66

77
/// **What it does:** Checks for explicit deref() or deref_mut() method calls.
88
///
@@ -19,16 +19,16 @@ use crate::utils::span_lint_and_sugg;
1919
/// let f = a.deref().unwrap();
2020
/// ```
2121
declare_clippy_lint! {
22-
pub DEREF_METHOD_EXPLICIT,
23-
complexity,
22+
pub EXPLICIT_DEREF_METHOD,
23+
pedantic,
2424
"Explicit use of deref or deref_mut method while not in a method chain."
2525
}
2626

2727
pub struct Pass;
2828

2929
impl LintPass for Pass {
3030
fn get_lints(&self) -> LintArray {
31-
lint_array!(DEREF_METHOD_EXPLICIT)
31+
lint_array!(EXPLICIT_DEREF_METHOD)
3232
}
3333
}
3434

@@ -46,7 +46,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
4646
"deref" => {
4747
span_lint_and_sugg(
4848
cx,
49-
DEREF_METHOD_EXPLICIT,
49+
EXPLICIT_DEREF_METHOD,
5050
expr.span,
5151
"explicit deref method call",
5252
"try this",
@@ -56,7 +56,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
5656
"deref_mut" => {
5757
span_lint_and_sugg(
5858
cx,
59-
DEREF_METHOD_EXPLICIT,
59+
EXPLICIT_DEREF_METHOD,
6060
expr.span,
6161
"explicit deref_mut method call",
6262
"try this",

clippy_lints/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
10621062
LintId::of(&copies::SAME_FUNCTIONS_IN_IF_CONDITION),
10631063
LintId::of(&copy_iterator::COPY_ITERATOR),
10641064
LintId::of(&default_trait_access::DEFAULT_TRAIT_ACCESS),
1065+
LintId::of(&dereference::EXPLICIT_DEREF_METHOD),
10651066
LintId::of(&derive::EXPL_IMPL_CLONE_ON_COPY),
10661067
LintId::of(&doc::DOC_MARKDOWN),
10671068
LintId::of(&doc::MISSING_ERRORS_DOC),
@@ -1146,7 +1147,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
11461147
LintId::of(&comparison_chain::COMPARISON_CHAIN),
11471148
LintId::of(&copies::IFS_SAME_COND),
11481149
LintId::of(&copies::IF_SAME_THEN_ELSE),
1149-
LintId::of(&dereference::DEREF_METHOD_EXPLICIT),
1150+
LintId::of(&dereference::EXPLICIT_DEREF_METHOD),
11501151
LintId::of(&derive::DERIVE_HASH_XOR_EQ),
11511152
LintId::of(&doc::MISSING_SAFETY_DOC),
11521153
LintId::of(&doc::NEEDLESS_DOCTEST_MAIN),

tests/ui/dereference.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::ops::{Deref, DerefMut};
44

55
#[allow(clippy::many_single_char_names, clippy::clone_double_ref)]
66
#[allow(unused_variables)]
7-
#[warn(clippy::deref_method_explicit)]
7+
#[warn(clippy::explicit_deref_method)]
88
fn main() {
99
let a: &mut String = &mut String::from("foo");
1010

tests/ui/dereference.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: explicit deref method call
44
13 | let b: &str = a.deref();
55
| ^^^^^^^^^ help: try this: `&*a`
66
|
7-
= note: `-D clippy::deref-method-explicit` implied by `-D warnings`
7+
= note: `-D clippy::explicit-deref-method` implied by `-D warnings`
88

99
error: explicit deref_mut method call
1010
--> $DIR/dereference.rs:17:27

0 commit comments

Comments
 (0)