Skip to content

Commit 938fd78

Browse files
authored
Merge pull request #8094 from cakebaker/uname_fix_order_of_output
uname: output OS last
2 parents a1c0760 + 05bcb65 commit 938fd78

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

src/uu/uname/src/uname.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,21 @@ pub struct UNameOutput {
3838

3939
impl UNameOutput {
4040
fn display(&self) -> String {
41-
let mut output = String::new();
42-
for name in [
41+
[
4342
self.kernel_name.as_ref(),
4443
self.nodename.as_ref(),
4544
self.kernel_release.as_ref(),
4645
self.kernel_version.as_ref(),
4746
self.machine.as_ref(),
48-
self.os.as_ref(),
4947
self.processor.as_ref(),
5048
self.hardware_platform.as_ref(),
49+
self.os.as_ref(),
5150
]
5251
.into_iter()
5352
.flatten()
54-
{
55-
output.push_str(name);
56-
output.push(' ');
57-
}
58-
output
53+
.map(|name| name.as_str())
54+
.collect::<Vec<_>>()
55+
.join(" ")
5956
}
6057

6158
pub fn new(opts: &Options) -> UResult<Self> {
@@ -138,7 +135,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
138135
os: matches.get_flag(options::OS),
139136
};
140137
let output = UNameOutput::new(&options)?;
141-
println!("{}", output.display().trim_end());
138+
println!("{}", output.display());
142139
Ok(())
143140
}
144141

0 commit comments

Comments
 (0)