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

[0.2] ci: use some tricks to format macro bodies #4110

Merged
merged 6 commits into from
Nov 19, 2024

Commits on Nov 19, 2024

  1. Adjust the f! macro to be more flexible

    Currently this only matches `$body` if every line ends with a semicolon.
    Make this simpler by just using the `block` matcher.
    
    Additionally, allow a trailing comma.
    
    (backport <rust-lang#4107>)
    (cherry picked from commit 0ac42fd)
    tgross35 committed Nov 19, 2024
    Configuration menu
    Copy the full SHA
    92c198c View commit details
    Browse the repository at this point in the history
  2. ci: Disable the check for >1 s! invocation

    Apparently we already violate this in a few places, it just doesn't show
    up because whitespace doesn't line up with what we expect (lack of
    formatting). Just disable it for now so we can format the files.
    
    (backport <rust-lang#4107>)
    (cherry picked from commit 0189456)
    tgross35 committed Nov 19, 2024
    Configuration menu
    Copy the full SHA
    ca8dcbf View commit details
    Browse the repository at this point in the history
  3. ci: Only invoke rustup if running in CI

    The script shouldn't need to update `rustfmt` every time it gets run.
    
    Additionally, only pass `--check` when in CI so this script can be used
    for invoking the formatter locally.
    
    (backport <rust-lang#4107>)
    (cherry picked from commit 64ed860)
    tgross35 committed Nov 19, 2024
    Configuration menu
    Copy the full SHA
    818255b View commit details
    Browse the repository at this point in the history
  4. ci: Use some tricks to format macro bodies

    We have a lot of syntax contained within macro bodies, which `rustfmt`
    doesn't touch. Add a hack that replaces relevant macro invocations with
    functions, formats, then resets.
    
    (backport <rust-lang#4107>)
    (cherry picked from commit 6ab46bb)
    tgross35 committed Nov 19, 2024
    Configuration menu
    Copy the full SHA
    d8ccae5 View commit details
    Browse the repository at this point in the history
  5. Apply formatting to macro bodies

    Run `ci/style.sh` with the changes introduced in [1].
    
    [1]: rust-lang#4107
    
    (backport <rust-lang#4107>)
    
    This is the `libc-0.2` version of 49cb0ff ("Apply formatting to macro
    bodies"), though not a direct cherry pick.
    tgross35 committed Nov 19, 2024
    Configuration menu
    Copy the full SHA
    50f26e0 View commit details
    Browse the repository at this point in the history
  6. Introduce a git-blame-ignore-revs file

    Start with the commit for formatting macro bodies in [1].
    
    [1]: rust-lang#4107
    
    (backport <rust-lang#4107>)
    
    This is the `libc-0.2` version of 6269954 ("Introduce a
    git-blame-ignore-revs file") with the ignored rev changed to what is
    applicable for this branch.
    tgross35 committed Nov 19, 2024
    Configuration menu
    Copy the full SHA
    7cffa23 View commit details
    Browse the repository at this point in the history