Skip to content

Conversation

@qmonnet
Copy link
Owner

@qmonnet qmonnet commented May 9, 2025

  • rbpf: Improve formatting, prepare/protect for rustfmt
  • clippy: Fix Clippy report
  • rbpf: Apply rustfmt on the whole repository

For a long time I've been reluctant to use rustfmt on the sources, because of sections that I didn't want to be reformatted: some alignments in the lists of instructions in the interpreter, or the byte arrays for BPF programs, and so on.

This PR marks all relevant sections as ignored by rustfmt, improves some of the formatting (and addresses Clippy reports) in preparation for rustfmt, and at last, apply rustfmt to the Rust source files.

This makes formatting consistent at last throughout the code base, and can be later enforced in CI - although there's no immediate plan for that. It will also make it easier to contributors who run rustfmt on save by default in their IDE.

qmonnet added 3 commits May 10, 2025 00:34
Slightly improve code formatting in a few places, and protect all blocks
that we don't want rustfmt to change by adding #[rustfmt::skip]
attributes where relevant. This is in preparation for running rustfmt on
the whole repository.

Signed-off-by: Quentin Monnet <[email protected]>
Signed-off-by: Quentin Monnet <[email protected]>
Let's fix formatting using rustfmt, at last.

    $ rustfmt --version
    rustfmt 1.8.0-nightly (50aa041807 2025-05-08)

    $ rustfmt **/**.rs

Signed-off-by: Quentin Monnet <[email protected]>
@qmonnet qmonnet merged commit 487d0bd into main May 10, 2025
8 checks passed
@qmonnet qmonnet deleted the pr/rustfmt branch May 10, 2025 01:01
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