Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

range_plus_one suggestion should not remove braces fix #3108

Merged
merged 8 commits into from
Sep 4, 2018
Merged

range_plus_one suggestion should not remove braces fix #3108

merged 8 commits into from
Sep 4, 2018

Conversation

daubaris
Copy link
Contributor

Looking into #3103 decided to go with the first suggestion.

#3103 (comment)

Added information to the known problems that lint adds unnecessary parentheses if the expression is not wrapped in a pair but starts with a opening parenthesis and ends with a closing one.

Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution and welcome to Clippy! Dogfood test currently fails on your code.

/// **Known problems:** Will add unnecessary pair of parentheses when the
/// expression is not wrapped in a pair but starts with a opening parenthesis
/// and ends with a closing one.
/// I.e: let _ = (f()+1)..(f()+1) results in let _ = ((f()+1)..(f()+1)).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backticks "`" around code missing. "results in let _ = ((f()+1)..=f())"

@@ -42,7 +42,7 @@ error: an inclusive range would be more readable
--> $DIR/range_plus_minus_one.rs:28:13
|
28 | let _ = (f()+1)..(f()+1);
| ^^^^^^^^^^^^^^^^ help: use: `(f()+1)..=f()`
| ^^^^^^^^^^^^^^^^ help: use: `((f()+1)..=f())`
Copy link
Member

@flip1995 flip1995 Aug 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add another test especially for the issue #3103 .

@flip1995 flip1995 added the S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) label Sep 3, 2018
/// **Known problems:** Will add unnecessary pair of parentheses when the
/// expression is not wrapped in a pair but starts with a opening parenthesis
/// and ends with a closing one.
/// I.e: `let _ = (f()+1)..(f()+1)` results in `let _ = ((f()+1)..(f()+1))`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second let _ = ((f()+1)..(f()+1)) should be let _ = ((f()+1)..=f())

Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!
Appveyor failure is unrelated #3118

@flip1995 flip1995 merged commit ed38d9c into rust-lang:master Sep 4, 2018
@daubaris daubaris deleted the range-plus-one branch September 5, 2018 04:21
@Manishearth
Copy link
Member

Hi! Could you leave the requested comment in #3230 for relicensing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants