Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 5948959

Browse files
committed
Fix misnomer braces -> parenthesis
1 parent 8bc1be1 commit 5948959

12 files changed

+38
-38
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3596,7 +3596,7 @@ Released 2018-09-13
35963596
[`needless_bool`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool
35973597
[`needless_borrow`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
35983598
[`needless_borrowed_reference`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowed_reference
3599-
[`needless_braces_on_range_literal`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_braces_on_range_literal
3599+
[`needless_parens_on_range_literal`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_parens_on_range_literal
36003600
[`needless_collect`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_collect
36013601
[`needless_continue`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_continue
36023602
[`needless_doctest_main`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_doctest_main

clippy_lints/src/lib.register_all.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ store.register_group(true, "clippy::all", Some("clippy_all"), vec![
241241
LintId::of(needless_bool::BOOL_COMPARISON),
242242
LintId::of(needless_bool::NEEDLESS_BOOL),
243243
LintId::of(needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE),
244-
LintId::of(needless_braces_on_range_literal::NEEDLESS_BRACES_ON_RANGE_LITERAL),
244+
LintId::of(needless_parens_on_range_literal::NEEDLESS_PARENS_ON_RANGE_LITERAL),
245245
LintId::of(needless_late_init::NEEDLESS_LATE_INIT),
246246
LintId::of(needless_question_mark::NEEDLESS_QUESTION_MARK),
247247
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
@@ -405,7 +405,7 @@ store.register_lints(&[
405405
needless_bool::BOOL_COMPARISON,
406406
needless_bool::NEEDLESS_BOOL,
407407
needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE,
408-
needless_braces_on_range_literal::NEEDLESS_BRACES_ON_RANGE_LITERAL,
408+
needless_parens_on_range_literal::NEEDLESS_PARENS_ON_RANGE_LITERAL,
409409
needless_continue::NEEDLESS_CONTINUE,
410410
needless_for_each::NEEDLESS_FOR_EACH,
411411
needless_late_init::NEEDLESS_LATE_INIT,

clippy_lints/src/lib.register_style.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ store.register_group(true, "clippy::style", Some("clippy_style"), vec![
9090
LintId::of(misc_early::REDUNDANT_PATTERN),
9191
LintId::of(mut_mutex_lock::MUT_MUTEX_LOCK),
9292
LintId::of(mut_reference::UNNECESSARY_MUT_PASSED),
93-
LintId::of(needless_braces_on_range_literal::NEEDLESS_BRACES_ON_RANGE_LITERAL),
93+
LintId::of(needless_parens_on_range_literal::NEEDLESS_PARENS_ON_RANGE_LITERAL),
9494
LintId::of(needless_late_init::NEEDLESS_LATE_INIT),
9595
LintId::of(neg_multiply::NEG_MULTIPLY),
9696
LintId::of(new_without_default::NEW_WITHOUT_DEFAULT),

clippy_lints/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,10 @@ mod needless_arbitrary_self_type;
312312
mod needless_bitwise_bool;
313313
mod needless_bool;
314314
mod needless_borrowed_ref;
315-
mod needless_braces_on_range_literal;
316315
mod needless_continue;
317316
mod needless_for_each;
318317
mod needless_late_init;
318+
mod needless_parens_on_range_literal;
319319
mod needless_pass_by_value;
320320
mod needless_question_mark;
321321
mod needless_update;
@@ -747,7 +747,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
747747
store.register_early_pass(|| Box::new(collapsible_if::CollapsibleIf));
748748
store.register_early_pass(|| Box::new(items_after_statements::ItemsAfterStatements));
749749
store.register_early_pass(|| Box::new(precedence::Precedence));
750-
store.register_early_pass(|| Box::new(needless_braces_on_range_literal::NeedlessBracesOnRangeLiteral));
750+
store.register_early_pass(|| Box::new(needless_parens_on_range_literal::NeedlessParensOnRangeLiteral));
751751
store.register_early_pass(|| Box::new(needless_continue::NeedlessContinue));
752752
store.register_early_pass(|| Box::new(redundant_else::RedundantElse));
753753
store.register_late_pass(|| Box::new(create_dir::CreateDir));

clippy_lints/src/needless_braces_on_range_literal.rs renamed to clippy_lints/src/needless_parens_on_range_literal.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Checks for braces on literals in range statements
1+
//! Checks for parantheses on literals in range statements
22
//!
33
//! For example, the lint would catch
44
//!
@@ -25,28 +25,28 @@ use rustc_session::{declare_lint_pass, declare_tool_lint};
2525

2626
declare_clippy_lint! {
2727
/// ### What it does
28-
/// The lint checks for braces on literals in range statements that are
28+
/// The lint checks for parenthesis on literals in range statements that are
2929
/// superflous.
3030
///
3131
/// ### Why is this bad?
32-
/// Having superflous braces makes the code less legible as the impose an
32+
/// Having superflous parenthesis makes the code less legible as the impose an
3333
/// overhead when reading.
3434
3535
#[clippy::version = "1.63.0"]
36-
pub NEEDLESS_BRACES_ON_RANGE_LITERAL,
36+
pub NEEDLESS_PARENS_ON_RANGE_LITERAL,
3737
style,
38-
"needless braces on range literal can be removed"
38+
"needless parenthesis on range literal can be removed"
3939
}
4040

41-
declare_lint_pass!(NeedlessBracesOnRangeLiteral => [NEEDLESS_BRACES_ON_RANGE_LITERAL]);
41+
declare_lint_pass!(NeedlessParensOnRangeLiteral => [NEEDLESS_PARENS_ON_RANGE_LITERAL]);
4242

43-
fn check_for_braces(cx: &EarlyContext<'_>, e: &Expr) {
43+
fn check_for_parens(cx: &EarlyContext<'_>, e: &Expr) {
4444
if_chain! {
4545
if let ExprKind::Paren(ref start_statement) = &e.kind;
4646
if let ExprKind::Lit(ref literal) = start_statement.kind;
4747
then {
48-
span_lint_and_then(cx, NEEDLESS_BRACES_ON_RANGE_LITERAL, e.span,
49-
"needless braces on range literal can be removed",
48+
span_lint_and_then(cx, NEEDLESS_PARENS_ON_RANGE_LITERAL, e.span,
49+
"needless parenthesis on range literal can be removed",
5050
|diag| {
5151
if let Some(suggestion) = snippet_opt(cx, literal.span) {
5252
diag.span_suggestion(e.span, "try", suggestion, Applicability::MachineApplicable);
@@ -56,11 +56,11 @@ fn check_for_braces(cx: &EarlyContext<'_>, e: &Expr) {
5656
}
5757
}
5858

59-
impl EarlyLintPass for NeedlessBracesOnRangeLiteral {
59+
impl EarlyLintPass for NeedlessParensOnRangeLiteral {
6060
fn check_expr(&mut self, cx: &EarlyContext<'_>, e: &Expr) {
6161
if let ExprKind::Range(Some(start), Some(end), _) = &e.kind {
62-
check_for_braces(cx, start);
63-
check_for_braces(cx, end);
62+
check_for_parens(cx, start);
63+
check_for_parens(cx, end);
6464
}
6565
}
6666
}

tests/ui/almost_complete_letter_range.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#![feature(stmt_expr_attributes)]
77
#![warn(clippy::almost_complete_letter_range)]
88
#![allow(ellipsis_inclusive_range_patterns)]
9-
#![allow(clippy::needless_braces_on_range_literal)]
9+
#![allow(clippy::needless_parens_on_range_literal)]
1010

1111
macro_rules! a {
1212
() => {

tests/ui/almost_complete_letter_range.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#![feature(stmt_expr_attributes)]
77
#![warn(clippy::almost_complete_letter_range)]
88
#![allow(ellipsis_inclusive_range_patterns)]
9-
#![allow(clippy::needless_braces_on_range_literal)]
9+
#![allow(clippy::needless_parens_on_range_literal)]
1010

1111
macro_rules! a {
1212
() => {

tests/ui/needless_braces_on_range_literal.stderr

Lines changed: 0 additions & 16 deletions
This file was deleted.

tests/ui/needless_braces_on_range_literal.fixed renamed to tests/ui/needless_parens_on_range_literal.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// run-rustfix
22
// edition:2018
33

4-
#![warn(clippy::needless_braces_on_range_literal)]
4+
#![warn(clippy::needless_parens_on_range_literal)]
55
#![allow(clippy::almost_complete_letter_range)]
66

77
fn main() {

0 commit comments

Comments
 (0)