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

Add new targets to run rustfmt for Rust projects #13932

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bonzini
Copy link
Collaborator

@bonzini bonzini commented Nov 20, 2024

Similar to the existing targets invoking clang-format, this PR adds two targets rustfmt and rustfmt-check that invoke rustfmt.

The basic logic is the same as for clippy, including reusing the updated run_tool infrastructure and the RustCompiler.get_rust_tool method.

@bonzini bonzini force-pushed the rustfmt branch 2 times, most recently from ed847b1 to ebb433c Compare November 20, 2024 19:33
@bonzini
Copy link
Collaborator Author

bonzini commented Dec 6, 2024

Rebased on top of the updated #13914.

@bonzini bonzini force-pushed the rustfmt branch 3 times, most recently from d732c1f to 3ae4a45 Compare December 9, 2024 13:43
mesonbuild/scripts/clippy.py Dismissed Show dismissed Hide dismissed
from ..mesonlib import MachineChoice

if T.TYPE_CHECKING:
from ..compilers.rust import RustCompiler

Check notice

Code scanning / CodeQL

Unused import Note

Import of 'RustCompiler' is not used.
Copy link
Member

@dcbaker dcbaker left a comment

Choose a reason for hiding this comment

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

A couple of small nits, and I think a cleanup of the test case, but otherwise this looks good to me.

mesonbuild/backend/ninjabackend.py Show resolved Hide resolved
mesonbuild/scripts/rustfmt.py Outdated Show resolved Hide resolved
unittests/allplatformstests.py Outdated Show resolved Hide resolved
@bonzini bonzini requested a review from dcbaker December 19, 2024 17:49
@bonzini bonzini marked this pull request as ready for review December 19, 2024 17:49
@bonzini bonzini requested a review from jpakkane as a code owner December 19, 2024 17:49
unittests/allplatformstests.py Outdated Show resolved Hide resolved
This is very similar to clippy, with different command line of course.
Also it can change files, so do not run it twice on the same file.

Signed-off-by: Paolo Bonzini <[email protected]>
@bonzini bonzini marked this pull request as draft December 20, 2024 17:09
@bonzini
Copy link
Collaborator Author

bonzini commented Dec 20, 2024

Moving to draft because it doesn't work with structured sources.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants