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

Tweak output for 'add line' suggestion #109786

Merged
merged 2 commits into from
Apr 13, 2023

Conversation

estebank
Copy link
Contributor

@estebank estebank commented Mar 30, 2023

Closes #108174

@rustbot
Copy link
Collaborator

rustbot commented Mar 30, 2023

r? @compiler-errors

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 30, 2023
@rustbot
Copy link
Collaborator

rustbot commented Mar 30, 2023

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@estebank
Copy link
Contributor Author

For the "add context line" part of this PR, we could alternatively peek at the suggestion and see if it starts with #[ and only provide context then.

@bors
Copy link
Contributor

bors commented Apr 3, 2023

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

Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

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

Perhaps we can do something like... checking that the span of the suggestion isn't DUMMY_SP (to avoid those use suggestions) or that the suggestion starts with #[derive...? Thoughts?

@estebank
Copy link
Contributor Author

We already check for DUMMY_SP (I'm not seeing any incorrect use item). I considered specializing the #[derive check and would require a bit of a refactor, but that could potentially be made to work. Do you feel this later check is a pre-condition to merge this PR? I can do it, just will take me a bit to do so.

@compiler-errors
Copy link
Member

compiler-errors commented Apr 10, 2023

Maybe we should suppress this behavior if the suggestion ends in two newlines \n\n, and then the suggestions like "add this impl" or "add this use" where we want to skip rendering the next line should be made two have two trailing newlines. That would also probably make their rustfix behavior a bit better, since they would render like:

use ...;

struct Foo;

instead of:

use ...;
struct Foo;

@estebank
Copy link
Contributor Author

I did a quick check for starts with #[ and ends with ]\n (newline is implicit in the code, you won't see it explicitly in the pattern) and only emit the following line for those.

@bors
Copy link
Contributor

bors commented Apr 12, 2023

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

@compiler-errors
Copy link
Member

r=me after rebase

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 12, 2023
@estebank
Copy link
Contributor Author

@bors r=compiler-errors

@bors
Copy link
Contributor

bors commented Apr 12, 2023

📌 Commit 9fadcc1 has been approved by compiler-errors

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 12, 2023
@bors
Copy link
Contributor

bors commented Apr 13, 2023

⌛ Testing commit 9fadcc1 with merge d37e2f7...

@bors
Copy link
Contributor

bors commented Apr 13, 2023

☀️ Test successful - checks-actions
Approved by: compiler-errors
Pushing d37e2f7 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 13, 2023
@bors bors merged commit d37e2f7 into rust-lang:master Apr 13, 2023
@rustbot rustbot added this to the 1.70.0 milestone Apr 13, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (d37e2f7): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.5% [0.5%, 0.6%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.8% [-2.8%, -2.8%] 1
All ❌✅ (primary) 0.5% [0.5%, 0.6%] 2

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.8% [0.8%, 0.8%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.4% [-0.4%, -0.4%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.2% [-0.4%, 0.8%] 2

@estebank estebank deleted the tweak-add-line-sugg branch November 9, 2023 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

Copy supertrait not holding error has empty note
5 participants