rust-lang / rustfmt

Format Rust code
https://rust-lang.github.io/rustfmt/
Apache License 2.0
5.85k stars 860 forks source link

support XDG_CONFIG_HOME for configuration file on macOS #6181

Open heygarrett opened 4 weeks ago

heygarrett commented 4 weeks ago

Fixes #4613

Replacing dirs with etcetera adds support for checking XDG_CONFIG_HOME on macOS when looking for a configuration file.

I'm new to Rust, so let me know if I'm missing anything!

ytmimi commented 5 days ago

I took a quick look at the dirs README and the dirs code, and both seem to suggest that XDG_CONFIG_HOME is already supported by dirs.

ytmimi commented 5 days ago

Oh wait, that's just for linux. Reopening.

ytmimi commented 5 days ago

@heygarrett we've had issues in the past where users have reported configs not being loaded properly. To avoid any breakage due to the proposed switch to etcetera I think we'll need to include some tests to validate that the existing config loading behavior won't change, and that we're only adding support for new config directories.

In the past I tried adding tests for the config loading rules, though I'm not entirely sure if that old PR is the best approach for this. Maybe you can use it as inspiration though.

heygarrett commented 5 days ago

Thanks, @ytmimi! I'll take a look.