Skip to content

Replace stray println!() in lint code by bug!() #14618

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 16, 2025

Conversation

samueltardieu
Copy link
Contributor

To avoid crashing Clippy, the bug!() is used only when debug assertions are enabled. In regular usage, the result will be the same as before, but without the extra line printed on the standard output which has the potential for disrupting shell scripts.

changelog: none

To avoid crashing Clippy, the `bug!()` is used only when debug assertions are
enabled. In regular usage, the result will be the same as before, but without
the extra line printed on the standard output which has the potential for
disrupting shell scripts.
@rustbot
Copy link
Collaborator

rustbot commented Apr 15, 2025

r? @blyxyas

rustbot has assigned @blyxyas.
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 15, 2025
@samueltardieu
Copy link
Contributor Author

I haven't looked in details why this could trigger, but using println!() is wronger than using bug!() when debug assertions are enabled. Feel free to propose a better solution.

Copy link
Member

@blyxyas blyxyas left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! ❤️ I think that we should get some more use out of debug assertions in Clippy to build better software. Also, something that I'd like to note for future reference is that as lintcheck runs Clippy in debug mode, this bug! will trigger if it finds an unknown item in CI :)

@blyxyas blyxyas added this pull request to the merge queue Apr 16, 2025
Merged via the queue into rust-lang:master with commit 08c78e0 Apr 16, 2025
11 checks passed
@samueltardieu samueltardieu deleted the remove-stray-println branch April 16, 2025 18:36
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.

3 participants