Stop Rustfmt adding line breaks
⚓ Rust 📅 2025-10-31 👤 surdeus 👁️ 5I am trying to stop rustfrm from adding line breaks where they break the visual flow of my code.
I have a piece of code like this which is essentially a 3x4 matrix in a pattern match.
[_, Term::OWL(VOWL::AssertionProperty), pr], //:
[_, Term::OWL(VOWL::SourceIndividual), Term::Iri(i)], //:
[_, target_type, target], //:
[_, Term::RDF(VRDF::Type), Term::OWL(VOWL::NegativePropertyAssertion)], //:
I was under the impression that the //: would make rustfmt leave the line alone, but it doesn't.
[_, Term::OWL(VOWL::AssertionProperty), pr], //:
[_, Term::OWL(VOWL::SourceIndividual), Term::Iri(i)], //:
[_, target_type, target], //:
[
_,
Term::RDF(VRDF::Type),
Term::OWL(VOWL::NegativePropertyAssertion),
], //:
It breaks up the three pattern for the last element by adding new lines (and adds trailing commas, which I can live with). It does leave the previous lines along, which is strange, as I would have thought it should add a trailing comma there also.
Any thoughts on how to stop this? I could add #[rustfmt::skip] but that is going to need to be done in quite a few places.
3 posts - 2 participants
🏷️ Rust_feed