rust: Add a make rustfmt, run it

It is actually really nice that there's One Canonical Style, even
if I sometimes don't like some details of what rustfmt does.

Closes: #1444
Approved by: jlebon
This commit is contained in:
Colin Walters 2018-07-04 19:47:45 +00:00 committed by Atomic Bot
parent e731f59007
commit d7b4046599
2 changed files with 7 additions and 1 deletions

View File

@ -103,4 +103,8 @@ EXTRA_DIST += $(LIBRPMOSTREE_RUST_SRCS) rust/Cargo.lock
rpm_ostree_CFLAGS += -Irust/include
rpm_ostree_SOURCES += rust/include/librpmostree-rust.h
rpm_ostree_LDADD += $(librpmostree_rust_path)
rustfmt:
rustfmt $(LIBRPMOSTREE_RUST_SRCS)
endif # ENABLE_RUST
# Outside the ifdef, otherwise automake complains
.PHONY: rustfmt

View File

@ -50,7 +50,9 @@ pub fn treefile_read_impl<W: io::Write>(filename: &Path, output: W) -> io::Resul
}
fn whitespace_split_packages(pkgs: &[String]) -> Vec<String> {
pkgs.iter().flat_map(|pkg| pkg.split_whitespace().map(String::from)).collect()
pkgs.iter()
.flat_map(|pkg| pkg.split_whitespace().map(String::from))
.collect()
}
#[derive(Serialize, Deserialize, Debug)]