-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Suggest let for assignment, and some code refactor #101908
Conversation
r? @oli-obk (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
By the way, |
b62b110
to
1a76ead
Compare
92e6500
to
14a7042
Compare
We should, but better to do it as part of its own PR. |
☔ The latest upstream changes (presumably #102450) made this pull request unmergeable. Please resolve the merge conflicts. |
99a33b3
to
7d201c9
Compare
r? @estebank |
☔ The latest upstream changes (presumably #103185) made this pull request unmergeable. Please resolve the merge conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me after rebasing (ping me and I'll approve)
let has_eq = matches!(sm.span_to_snippet(eq_span), Ok(ref snippet) if snippet == "="); | ||
if has_eq { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can now be written as follows
let has_eq = matches!(sm.span_to_snippet(eq_span), Ok(ref snippet) if snippet == "="); | |
if has_eq { | |
if let Ok(ref snippet) = sm.span_to_snippet(eq_span) && snippet == "=" { |
let ident_name = sm.span_to_snippet(ident_span).unwrap(); | ||
if sm | ||
.span_to_snippet(line_span) | ||
.map_or(false, |s| s.trim().starts_with(&ident_name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this check to protect against macros or something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes. Saw the dbg!(binding)
case in the test. Hacky, but makes sense!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
emm, I will add a comment for this.
7d201c9
to
d808fb0
Compare
This comment has been minimized.
This comment has been minimized.
d808fb0
to
eb68e27
Compare
break; | ||
} | ||
} | ||
let closing_span = sm.span_look_ahead(span, Some("}"), Some(50)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the next_point
bug is fixed, this is changed from 100
to 50
😂
r? @estebank |
@bors r+ |
Suggest let for assignment, and some code refactor Fixes rust-lang#101880
Rollup of 6 pull requests Successful merges: - rust-lang#101293 (Recover when unclosed char literal is parsed as a lifetime in some positions) - rust-lang#101908 (Suggest let for assignment, and some code refactor) - rust-lang#103192 (rustdoc: Eliminate uses of `EarlyDocLinkResolver::all_traits`) - rust-lang#103226 (Check `needs_infer` before `needs_drop` during HIR generator analysis) - rust-lang#103249 (resolve: Revert "Set effective visibilities for imports more precisely") - rust-lang#103305 (Move some tests to more reasonable places) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Thank you @chenyukang |
Fixes #101880