macisamuele / language-formatters-pre-commit-hooks

Collection of custom pre-commit hooks.
Apache License 2.0
112 stars 56 forks source link

Rust: add support to non-root folder Config.toml #210

Closed AJIOB closed 3 months ago

AJIOB commented 6 months ago

cargo fmt has support to --manifest-path argument, that can be used for passing Config.toml location.

It can be used in this way: cargo fmt --manifest-path my/subdir/Cargo.toml -- --check.

It is useful when your repository contains Cargo.toml in the non-root location.

macisamuele commented 6 months ago

@AJIOB thanks for the report. PRs are welcome, feel free to open one and I'll be happy to review.

Via a quick search I've found out https://github.com/rust-lang/cargo/issues/7856, please make sure that the behaviour is as you expect.

About a possible guidance, I would add an optional parameter (defaulted to Cargo.toml) in the pretty-format-rust such the change will not be a breaking one, while allowing extension to provide customers to customise the manifest file