Add check for += typo in let chains#147951
Merged
bors merged 2 commits intorust-lang:masterfrom Nov 4, 2025
Merged
Conversation
Member
Author
|
(info for assigned reviewer or whoever wants pick this up for review, if you found that this is in good state as it, and there is nothing crucial that needed to be added or improved, and you want to rollup this, please, before doing so run bors try on aarch64-msvc-1, i have some kind of paranoia after this #147421 (comment), thanks) |
This comment has been minimized.
This comment has been minimized.
96dba30 to
e4d765b
Compare
Contributor
|
A suggestion to improve readability: Add a layer of abstraction to this 535-line |
Member
Author
|
@aklaiber I'm quite unsure, but in my opinion this is a little outside the scope of the current PR |
davidtwco
requested changes
Oct 25, 2025
e4d765b to
806b443
Compare
Kivooeo
commented
Oct 25, 2025
estebank
approved these changes
Oct 31, 2025
Member
Author
|
I will squash this commit before merge, just to make review easier for now |
davidtwco
approved these changes
Nov 3, 2025
Member
|
I don't mind the extra commit so we can save another cycle of back and forth @bors r+ rollup |
Collaborator
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this pull request
Nov 3, 2025
…avidtwco Add check for `+=` typo in let chains Fixes rust-lang#147664 it does affect only cases where variable exist in scope, because if the variable is not exist in scope, the suggestion will not make any sense I wanted to add suggestion for case where variable does not in scope to fix `y += 1` to `let y = 1` but I guess it's too much (not too much work, but too much wild predict of what user wants)? if it's good addition in your opinion I can add this in follow up in other things I guess impl is pretty much self-explanatory, if you see there is some possibilities to improve code or/and some _edge-cases_ that I could overlooked feel free to tell about it ah, also about why I think this change is good and why I originally took it, so it seems to me that this is possible to make this typo (I explained this in comment a little), like, both `+` and `=` is the same button (in most of layouts) and for this reasons I didn't added something like `-=` it seems more harder to make this typo r? diagnostics
bors
added a commit
that referenced
this pull request
Nov 3, 2025
Rollup of 7 pull requests Successful merges: - #147141 (Suggest making binding `mut` on `&mut` reborrow) - #147945 (Port `cfg!()` macro to the new attribute parsing system ) - #147951 (Add check for `+=` typo in let chains) - #148004 (fix: Only special case single line item attribute suggestions) - #148264 (reflect that type and const parameter can be intermixed) - #148363 (Fix `wasm_import_module` attribute cross-crate) - #148447 (Tweak E0401) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
that referenced
this pull request
Nov 4, 2025
Rollup merge of #147951 - Kivooeo:plus-equal-let-chains, r=davidtwco Add check for `+=` typo in let chains Fixes #147664 it does affect only cases where variable exist in scope, because if the variable is not exist in scope, the suggestion will not make any sense I wanted to add suggestion for case where variable does not in scope to fix `y += 1` to `let y = 1` but I guess it's too much (not too much work, but too much wild predict of what user wants)? if it's good addition in your opinion I can add this in follow up in other things I guess impl is pretty much self-explanatory, if you see there is some possibilities to improve code or/and some _edge-cases_ that I could overlooked feel free to tell about it ah, also about why I think this change is good and why I originally took it, so it seems to me that this is possible to make this typo (I explained this in comment a little), like, both `+` and `=` is the same button (in most of layouts) and for this reasons I didn't added something like `-=` it seems more harder to make this typo r? diagnostics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #147664
it does affect only cases where variable exist in scope, because if the variable is not exist in scope, the suggestion will not make any sense
I wanted to add suggestion for case where variable does not in scope to fix
y += 1tolet y = 1but I guess it's too much (not too much work, but too much wild predict of what user wants)? if it's good addition in your opinion I can add this in follow upin other things I guess impl is pretty much self-explanatory, if you see there is some possibilities to improve code or/and some edge-cases that I could overlooked feel free to tell about it
ah, also about why I think this change is good and why I originally took it, so it seems to me that this is possible to make this typo (I explained this in comment a little), like, both
+and=is the same button (in most of layouts) and for this reasons I didn't added something like-=it seems more harder to make this typor? diagnostics