Fix names to use plural
This commit is contained in:
parent
bf7a786481
commit
8ba377a783
@ -242,7 +242,7 @@ store.register_group(true, "clippy::all", Some("clippy_all"), vec![
|
||||
LintId::of(needless_bool::NEEDLESS_BOOL),
|
||||
LintId::of(needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE),
|
||||
LintId::of(needless_late_init::NEEDLESS_LATE_INIT),
|
||||
LintId::of(needless_parens_on_range_literal::NEEDLESS_PARENS_ON_RANGE_LITERAL),
|
||||
LintId::of(needless_parens_on_range_literals::NEEDLESS_PARENS_ON_RANGE_LITERALS),
|
||||
LintId::of(needless_question_mark::NEEDLESS_QUESTION_MARK),
|
||||
LintId::of(needless_update::NEEDLESS_UPDATE),
|
||||
LintId::of(neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD),
|
||||
|
@ -408,7 +408,7 @@ store.register_lints(&[
|
||||
needless_continue::NEEDLESS_CONTINUE,
|
||||
needless_for_each::NEEDLESS_FOR_EACH,
|
||||
needless_late_init::NEEDLESS_LATE_INIT,
|
||||
needless_parens_on_range_literal::NEEDLESS_PARENS_ON_RANGE_LITERAL,
|
||||
needless_parens_on_range_literals::NEEDLESS_PARENS_ON_RANGE_LITERALS,
|
||||
needless_pass_by_value::NEEDLESS_PASS_BY_VALUE,
|
||||
needless_question_mark::NEEDLESS_QUESTION_MARK,
|
||||
needless_update::NEEDLESS_UPDATE,
|
||||
|
@ -91,7 +91,7 @@ store.register_group(true, "clippy::style", Some("clippy_style"), vec![
|
||||
LintId::of(mut_mutex_lock::MUT_MUTEX_LOCK),
|
||||
LintId::of(mut_reference::UNNECESSARY_MUT_PASSED),
|
||||
LintId::of(needless_late_init::NEEDLESS_LATE_INIT),
|
||||
LintId::of(needless_parens_on_range_literal::NEEDLESS_PARENS_ON_RANGE_LITERAL),
|
||||
LintId::of(needless_parens_on_range_literals::NEEDLESS_PARENS_ON_RANGE_LITERALS),
|
||||
LintId::of(neg_multiply::NEG_MULTIPLY),
|
||||
LintId::of(new_without_default::NEW_WITHOUT_DEFAULT),
|
||||
LintId::of(non_copy_const::BORROW_INTERIOR_MUTABLE_CONST),
|
||||
|
@ -315,7 +315,7 @@ mod needless_borrowed_ref;
|
||||
mod needless_continue;
|
||||
mod needless_for_each;
|
||||
mod needless_late_init;
|
||||
mod needless_parens_on_range_literal;
|
||||
mod needless_parens_on_range_literals;
|
||||
mod needless_pass_by_value;
|
||||
mod needless_question_mark;
|
||||
mod needless_update;
|
||||
@ -747,7 +747,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
|
||||
store.register_early_pass(|| Box::new(collapsible_if::CollapsibleIf));
|
||||
store.register_early_pass(|| Box::new(items_after_statements::ItemsAfterStatements));
|
||||
store.register_early_pass(|| Box::new(precedence::Precedence));
|
||||
store.register_late_pass(|| Box::new(needless_parens_on_range_literal::NeedlessParensOnRangeLiteral));
|
||||
store.register_late_pass(|| Box::new(needless_parens_on_range_literals::NeedlessParensOnRangeLiterals));
|
||||
store.register_early_pass(|| Box::new(needless_continue::NeedlessContinue));
|
||||
store.register_early_pass(|| Box::new(redundant_else::RedundantElse));
|
||||
store.register_late_pass(|| Box::new(create_dir::CreateDir));
|
||||
|
@ -36,12 +36,12 @@ declare_clippy_lint! {
|
||||
/// }
|
||||
/// ```
|
||||
#[clippy::version = "1.63.0"]
|
||||
pub NEEDLESS_PARENS_ON_RANGE_LITERAL,
|
||||
pub NEEDLESS_PARENS_ON_RANGE_LITERALS,
|
||||
style,
|
||||
"needless parenthesis on range literal can be removed"
|
||||
"needless parenthesis on range literals can be removed"
|
||||
}
|
||||
|
||||
declare_lint_pass!(NeedlessParensOnRangeLiteral => [NEEDLESS_PARENS_ON_RANGE_LITERAL]);
|
||||
declare_lint_pass!(NeedlessParensOnRangeLiterals => [NEEDLESS_PARENS_ON_RANGE_LITERALS]);
|
||||
|
||||
fn snippet_enclosed_in_parenthesis(snippet: &str) -> bool {
|
||||
snippet.starts_with('(') && snippet.ends_with(')')
|
||||
@ -63,8 +63,8 @@ fn check_for_parens(cx: &LateContext<'_>, e: &Expr<'_>, is_start: bool) {
|
||||
if snippet_enclosed_in_parenthesis(&snippet(cx, e.span, ""));
|
||||
then {
|
||||
let mut applicability = Applicability::MachineApplicable;
|
||||
span_lint_and_then(cx, NEEDLESS_PARENS_ON_RANGE_LITERAL, e.span,
|
||||
"needless parenthesis on range literal can be removed",
|
||||
span_lint_and_then(cx, NEEDLESS_PARENS_ON_RANGE_LITERALS, e.span,
|
||||
"needless parenthesis on range literals can be removed",
|
||||
|diag| {
|
||||
let suggestion = snippet_with_applicability(cx, literal.span, "_", &mut applicability);
|
||||
diag.span_suggestion(e.span, "try", suggestion, applicability);
|
||||
@ -73,7 +73,7 @@ fn check_for_parens(cx: &LateContext<'_>, e: &Expr<'_>, is_start: bool) {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> LateLintPass<'tcx> for NeedlessParensOnRangeLiteral {
|
||||
impl<'tcx> LateLintPass<'tcx> for NeedlessParensOnRangeLiterals {
|
||||
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
|
||||
if let Some(higher::Range { start, end, .. }) = higher::Range::hir(expr) {
|
||||
if let Some(start) = start {
|
@ -6,7 +6,7 @@
|
||||
#![feature(stmt_expr_attributes)]
|
||||
#![warn(clippy::almost_complete_letter_range)]
|
||||
#![allow(ellipsis_inclusive_range_patterns)]
|
||||
#![allow(clippy::needless_parens_on_range_literal)]
|
||||
#![allow(clippy::needless_parens_on_range_literals)]
|
||||
|
||||
macro_rules! a {
|
||||
() => {
|
||||
|
@ -6,7 +6,7 @@
|
||||
#![feature(stmt_expr_attributes)]
|
||||
#![warn(clippy::almost_complete_letter_range)]
|
||||
#![allow(ellipsis_inclusive_range_patterns)]
|
||||
#![allow(clippy::needless_parens_on_range_literal)]
|
||||
#![allow(clippy::needless_parens_on_range_literals)]
|
||||
|
||||
macro_rules! a {
|
||||
() => {
|
||||
|
@ -1,40 +0,0 @@
|
||||
error: needless parenthesis on range literal can be removed
|
||||
--> $DIR/needless_parens_on_range_literal.rs:8:13
|
||||
|
|
||||
LL | let _ = ('a')..=('z');
|
||||
| ^^^^^ help: try: `'a'`
|
||||
|
|
||||
= note: `-D clippy::needless-parens-on-range-literal` implied by `-D warnings`
|
||||
|
||||
error: needless parenthesis on range literal can be removed
|
||||
--> $DIR/needless_parens_on_range_literal.rs:8:21
|
||||
|
|
||||
LL | let _ = ('a')..=('z');
|
||||
| ^^^^^ help: try: `'z'`
|
||||
|
||||
error: needless parenthesis on range literal can be removed
|
||||
--> $DIR/needless_parens_on_range_literal.rs:9:18
|
||||
|
|
||||
LL | let _ = 'a'..('z');
|
||||
| ^^^^^ help: try: `'z'`
|
||||
|
||||
error: needless parenthesis on range literal can be removed
|
||||
--> $DIR/needless_parens_on_range_literal.rs:11:19
|
||||
|
|
||||
LL | let _ = (1.)..(2.);
|
||||
| ^^^^ help: try: `2.`
|
||||
|
||||
error: needless parenthesis on range literal can be removed
|
||||
--> $DIR/needless_parens_on_range_literal.rs:12:13
|
||||
|
|
||||
LL | let _ = ('a')..;
|
||||
| ^^^^^ help: try: `'a'`
|
||||
|
||||
error: needless parenthesis on range literal can be removed
|
||||
--> $DIR/needless_parens_on_range_literal.rs:13:15
|
||||
|
|
||||
LL | let _ = ..('z');
|
||||
| ^^^^^ help: try: `'z'`
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
@ -1,7 +1,7 @@
|
||||
// run-rustfix
|
||||
// edition:2018
|
||||
|
||||
#![warn(clippy::needless_parens_on_range_literal)]
|
||||
#![warn(clippy::needless_parens_on_range_literals)]
|
||||
#![allow(clippy::almost_complete_letter_range)]
|
||||
|
||||
fn main() {
|
@ -1,7 +1,7 @@
|
||||
// run-rustfix
|
||||
// edition:2018
|
||||
|
||||
#![warn(clippy::needless_parens_on_range_literal)]
|
||||
#![warn(clippy::needless_parens_on_range_literals)]
|
||||
#![allow(clippy::almost_complete_letter_range)]
|
||||
|
||||
fn main() {
|
40
tests/ui/needless_parens_on_range_literals.stderr
Normal file
40
tests/ui/needless_parens_on_range_literals.stderr
Normal file
@ -0,0 +1,40 @@
|
||||
error: needless parenthesis on range literals can be removed
|
||||
--> $DIR/needless_parens_on_range_literals.rs:8:13
|
||||
|
|
||||
LL | let _ = ('a')..=('z');
|
||||
| ^^^^^ help: try: `'a'`
|
||||
|
|
||||
= note: `-D clippy::needless-parens-on-range-literals` implied by `-D warnings`
|
||||
|
||||
error: needless parenthesis on range literals can be removed
|
||||
--> $DIR/needless_parens_on_range_literals.rs:8:21
|
||||
|
|
||||
LL | let _ = ('a')..=('z');
|
||||
| ^^^^^ help: try: `'z'`
|
||||
|
||||
error: needless parenthesis on range literals can be removed
|
||||
--> $DIR/needless_parens_on_range_literals.rs:9:18
|
||||
|
|
||||
LL | let _ = 'a'..('z');
|
||||
| ^^^^^ help: try: `'z'`
|
||||
|
||||
error: needless parenthesis on range literals can be removed
|
||||
--> $DIR/needless_parens_on_range_literals.rs:11:19
|
||||
|
|
||||
LL | let _ = (1.)..(2.);
|
||||
| ^^^^ help: try: `2.`
|
||||
|
||||
error: needless parenthesis on range literals can be removed
|
||||
--> $DIR/needless_parens_on_range_literals.rs:12:13
|
||||
|
|
||||
LL | let _ = ('a')..;
|
||||
| ^^^^^ help: try: `'a'`
|
||||
|
||||
error: needless parenthesis on range literals can be removed
|
||||
--> $DIR/needless_parens_on_range_literals.rs:13:15
|
||||
|
|
||||
LL | let _ = ..('z');
|
||||
| ^^^^^ help: try: `'z'`
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
Loading…
x
Reference in New Issue
Block a user