mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-28 07:30:57 +00:00
Apply suggestions from code review
Co-authored-by: dswij <dharmasw@outlook.com>
This commit is contained in:
parent
58a605f453
commit
bf7a786481
1 changed files with 3 additions and 3 deletions
|
@ -14,10 +14,10 @@ use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||||
declare_clippy_lint! {
|
declare_clippy_lint! {
|
||||||
/// ### What it does
|
/// ### What it does
|
||||||
/// The lint checks for parenthesis on literals in range statements that are
|
/// The lint checks for parenthesis on literals in range statements that are
|
||||||
/// superflous.
|
/// superfluous.
|
||||||
///
|
///
|
||||||
/// ### Why is this bad?
|
/// ### Why is this bad?
|
||||||
/// Having superflous parenthesis makes the code less legible as the impose an
|
/// Having superfluous parenthesis makes the code less readable
|
||||||
/// overhead when reading.
|
/// overhead when reading.
|
||||||
///
|
///
|
||||||
/// ### Example
|
/// ### Example
|
||||||
|
@ -57,7 +57,7 @@ fn check_for_parens(cx: &LateContext<'_>, e: &Expr<'_>, is_start: bool) {
|
||||||
}
|
}
|
||||||
if_chain! {
|
if_chain! {
|
||||||
if let ExprKind::Lit(ref literal) = e.kind;
|
if let ExprKind::Lit(ref literal) = e.kind;
|
||||||
// the indicator that paranthese surround the literal is that span of the expression and the literal differ
|
// the indicator that parenthesis surround the literal is that the span of the expression and the literal differ
|
||||||
if (literal.span.data().hi - literal.span.data().lo) != (e.span.data().hi - e.span.data().lo);
|
if (literal.span.data().hi - literal.span.data().lo) != (e.span.data().hi - e.span.data().lo);
|
||||||
// inspect the source code of the expression for parenthesis
|
// inspect the source code of the expression for parenthesis
|
||||||
if snippet_enclosed_in_parenthesis(&snippet(cx, e.span, ""));
|
if snippet_enclosed_in_parenthesis(&snippet(cx, e.span, ""));
|
||||||
|
|
Loading…
Reference in a new issue