File tree Expand file tree Collapse file tree 1 file changed +16
-20
lines changed Expand file tree Collapse file tree 1 file changed +16
-20
lines changed Original file line number Diff line number Diff line change 1- //! Checks for parantheses on literals in range statements
2- //!
3- //! For example, the lint would catch
4- //!
5- //! ```rust
6- //! for i in (0)..10 {
7- //! println!("{i}");
8- //! }
9- //! ```
10- //!
11- //! Use instead:
12- //!
13- //! ```rust
14- //! for i in 0..10 {
15- //! println!("{i}");
16- //! }
17- //! ```
18- //!
19-
201use clippy_utils:: {
212 diagnostics:: span_lint_and_then,
223 higher,
@@ -38,7 +19,22 @@ declare_clippy_lint! {
3819 /// ### Why is this bad?
3920 /// Having superflous parenthesis makes the code less legible as the impose an
4021 /// overhead when reading.
41-
22+ ///
23+ /// ### Example
24+ ///
25+ /// ```rust
26+ /// for i in (0)..10 {
27+ /// println!("{i}");
28+ /// }
29+ /// ```
30+ ///
31+ /// Use instead:
32+ ///
33+ /// ```rust
34+ /// for i in 0..10 {
35+ /// println!("{i}");
36+ /// }
37+ /// ```
4238 #[ clippy:: version = "1.63.0" ]
4339 pub NEEDLESS_PARENS_ON_RANGE_LITERAL ,
4440 style,
You can’t perform that action at this time.
0 commit comments