tonic icon indicating copy to clipboard operation
tonic copied to clipboard

Generated code is not formatted with nightly compiler

Open PSeitz opened this issue 2 years ago • 10 comments

Version

pascal@pascal-G533QM ~/L/D/q/c/quickwit-proto (conf_sort)> cargo tree | grep tonic └── tonic v0.5.2 └── tonic-build v0.5.2

Platform

Linux pascal-G533QM 5.12.0-051200-generic #202104252130 SMP Sun Apr 25 21:33:13 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Description

In our project quickwit https://github.com/quickwit-inc/quickwit, the code is not formatted or formatted differently when I run the build_script https://github.com/quickwit-inc/quickwit/blob/main/quickwit-proto/build.rs.

cd quickwit-proto;cargo build

These are the generated files on my machine: cluster.txt quickwit.txt

PSeitz avatar Dec 17 '21 10:12 PSeitz

tonic-build's rustfmt feature should format the code.

davidpdrsn avatar Dec 17 '21 12:12 davidpdrsn

Can I check somehow why it doesn't?

PSeitz avatar Dec 17 '21 13:12 PSeitz

Read the code in tonic build 🤷‍♂️😂

Can you provide a reproduction script?

davidpdrsn avatar Dec 17 '21 14:12 davidpdrsn

Can you provide a reproduction script?

No, it happens only on my machine :)

PSeitz avatar Dec 17 '21 14:12 PSeitz

Then I’m not sure what could be going on. Maybe something is wrong with your rustfmt installation 🤷‍♂️

davidpdrsn avatar Dec 17 '21 14:12 davidpdrsn

The issue only occurs with the nightly compiler, stable works

PSeitz avatar Dec 20 '21 11:12 PSeitz

Does your nightly toolchain have rustfmt installed?

LucioFranco avatar Dec 30 '21 18:12 LucioFranco

Does your nightly toolchain have rustfmt installed?

Yes, e.g. this command completes cargo +nightly fmt --all -- --check

PSeitz avatar Dec 31 '21 11:12 PSeitz

Do you use rustup override set nightly in the directory?

LucioFranco avatar Jan 03 '22 21:01 LucioFranco

I have no overrides

rustup override list
     no overrides

Did you try to reproduce the issue?

formatting does not work (files changed)

git clone https://github.com/quickwit-inc/quickwit
cd quickwit;cd quickwit-proto;cargo +nightly build

formatting works (files unchanged)

git clone https://github.com/quickwit-inc/quickwit
cd quickwit;cd quickwit-proto;cargo +stable build

PSeitz avatar Jan 04 '22 13:01 PSeitz