Problem
dx fmt does not pick up settings from .rustfmt.toml. RSX blocks are formatted using rustfmt defaults instead of the project's configuration.
In two places, indentation_for is called with the hardcoded string ".":
Internally, indentation_for runs cargo fmt -- --print-config current <path>. When <path> is a directory, rustfmt does not walk up to find .rustfmt.toml and falls back to defaults. When <path> is an actual file (as on L175 for the whole-project case), it works correctly.
This can be verified. For example, with hard_tabs = true in .rustfmt.toml:
# Does NOT pick up .rustfmt.toml:
cargo fmt -- --print-config current .
# → hard_tabs = false
# Correctly picks up .rustfmt.toml:
cargo fmt -- --print-config current src/main.rs
# → hard_tabs = true
May also be related to #3433.
Steps To Reproduce
- Create a project with a
.rustfmt.toml containing any non-default setting (e.g. hard_tabs = true)
- Add a component using
rsx!
- Run
dx fmt -f src/main.rs or dx fmt --raw "div {}"
- Observe that RSX is formatted using rustfmt defaults, ignoring
.rustfmt.toml
Expected behavior
dx fmt should respect .rustfmt.toml when formatting RSX blocks in all modes.
Screenshots
N/A
Environment:
- Dioxus version: 0.7.9
- Rust version: 1.87
- OS info: Linux
- App platform: web
Questionnaire
I don't have time to fix this right now, but maybe later.
Problem
dx fmtdoes not pick up settings from.rustfmt.toml. RSX blocks are formatted using rustfmt defaults instead of the project's configuration.In two places,
indentation_foris called with the hardcoded string".":--rawmode)-f filemode)Internally,
indentation_forrunscargo fmt -- --print-config current <path>. When<path>is a directory, rustfmt does not walk up to find.rustfmt.tomland falls back to defaults. When<path>is an actual file (as on L175 for the whole-project case), it works correctly.This can be verified. For example, with
hard_tabs = truein.rustfmt.toml:May also be related to #3433.
Steps To Reproduce
.rustfmt.tomlcontaining any non-default setting (e.g.hard_tabs = true)rsx!dx fmt -f src/main.rsordx fmt --raw "div {}".rustfmt.tomlExpected behavior
dx fmtshould respect.rustfmt.tomlwhen formatting RSX blocks in all modes.Screenshots
N/A
Environment:
Questionnaire
I don't have time to fix this right now, but maybe later.