Skip to content

manual_div_ceil: fix suggestions when macro is involved #14666

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

Merged
merged 1 commit into from
Apr 27, 2025

Conversation

Kivooeo
Copy link
Contributor

@Kivooeo Kivooeo commented Apr 22, 2025

here is my small fix

changelog: fix suggestion span to avoid showing macro name in .div_ceil() suggestion

i changed this line
let divisor_snippet = snippet_with_applicability(cx, rhs.spansource_callsite(), "..", applicability);
to this line
let divisor_snippet = snippet_with_applicability(cx, rhs.span, "..", applicability);
to fix problem where this warning in macro expands like this

4  |         let _ = (x + 7) / 8;
   |                 ^^^^^^^^^^^ help: consider using `.div_ceil()`: `x.div_ceil(y!())`

play it yourself

as you can see here it looks like x.div_ceil(y!()) and contains macro signature
so i fixed this problem, i will look closely if there any more problems like this and fix them in order

Related issue

fixes rust-lang/rust-clippy#14665

@rustbot
Copy link
Collaborator

rustbot commented Apr 22, 2025

r? @dswij

rustbot has assigned @dswij.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Apr 22, 2025
@dswij
Copy link
Member

dswij commented Apr 22, 2025

Welcome to clippy @Kivooeo! :)

Just some meta information on opening PRs for Clippy:

  1. the changelog should be a summary of what the PR changes.
  2. if the PR will close the issue, it's preferable to write fixes ${issue_number} so the issue will be automatically closed once the PR is merged.

There is no need to cc the issue author unless necessary. We'd want to minimize ping for other people.

@Kivooeo
Copy link
Contributor Author

Kivooeo commented Apr 22, 2025

@dswij thanks for the quick review, check this changes ive made, is this any better or need any corrections?

@Kivooeo Kivooeo changed the title div ceil in macro suggestion fix (fixes #14665) div ceil in macro suggestion fix Apr 22, 2025
@dswij dswij added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Apr 22, 2025
@Kivooeo
Copy link
Contributor Author

Kivooeo commented Apr 22, 2025

@dswij should be done, double check everything pls

@Kivooeo
Copy link
Contributor Author

Kivooeo commented Apr 23, 2025

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties and removed S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels Apr 23, 2025
@dswij
Copy link
Member

dswij commented Apr 27, 2025

Thank you! @Kivooeo

@dswij dswij added this pull request to the merge queue Apr 27, 2025
@dswij dswij removed this pull request from the merge queue due to a manual request Apr 27, 2025
@dswij dswij changed the title div ceil in macro suggestion fix manual_div_ceil: fix suggestions when macro is involved Apr 27, 2025
@dswij dswij enabled auto-merge April 27, 2025 03:13
@dswij dswij added this pull request to the merge queue Apr 27, 2025
Merged via the queue into rust-lang:master with commit 39a4086 Apr 27, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wrong clippy suggestion for div_ceil in macro definition
4 participants