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

Suggest let for assignment, and some code refactor #101908

Merged
merged 1 commit into from
Oct 23, 2022

Conversation

chenyukang
Copy link
Member

Fixes #101880

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Sep 16, 2022
@rust-highfive
Copy link
Collaborator

r? @oli-obk

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 16, 2022
@chenyukang chenyukang marked this pull request as draft September 16, 2022 16:56
@rust-log-analyzer

This comment has been minimized.

@chenyukang
Copy link
Member Author

chenyukang commented Sep 17, 2022

By the way, smart_resolve_report_errors is tooo long and seems hard to maintain 😂
Should we refactor this part? @estebank

@chenyukang chenyukang marked this pull request as ready for review September 17, 2022 06:21
@estebank
Copy link
Contributor

By the way, smart_resolve_report_errors is tooo long and seems hard to maintain 😂 Should we refactor this part?

We should, but better to do it as part of its own PR.

@bors
Copy link
Contributor

bors commented Sep 29, 2022

☔ The latest upstream changes (presumably #102450) made this pull request unmergeable. Please resolve the merge conflicts.

@chenyukang
Copy link
Member Author

r? @estebank

@rust-highfive rust-highfive assigned estebank and unassigned oli-obk Oct 14, 2022
@bors
Copy link
Contributor

bors commented Oct 20, 2022

☔ The latest upstream changes (presumably #103185) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Contributor

@estebank estebank left a 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)

Comment on lines 1715 to 1716
let has_eq = matches!(sm.span_to_snippet(eq_span), Ok(ref snippet) if snippet == "=");
if has_eq {
Copy link
Contributor

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

Suggested change
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 == "=" {

Comment on lines 1747 to 1742
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))
Copy link
Contributor

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?

Copy link
Contributor

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!

Copy link
Member Author

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.

@rust-log-analyzer

This comment has been minimized.

break;
}
}
let closing_span = sm.span_look_ahead(span, Some("}"), Some(50));
Copy link
Member Author

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 😂

@chenyukang
Copy link
Member Author

r? @estebank

@estebank
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Oct 21, 2022

📌 Commit eb68e27 has been approved by estebank

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 21, 2022
notriddle added a commit to notriddle/rust that referenced this pull request Oct 21, 2022
Suggest let for assignment, and some code refactor

Fixes rust-lang#101880
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 23, 2022
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
@bors bors merged commit 518d5eb into rust-lang:master Oct 23, 2022
@rustbot rustbot added this to the 1.66.0 milestone Oct 23, 2022
@Kaligule
Copy link

Thank you @chenyukang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better error messages: Tell programmer about forgotten let
9 participants