Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions src/uu/uname/src/uname.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,21 @@ pub struct UNameOutput {

impl UNameOutput {
fn display(&self) -> String {
let mut output = String::new();
for name in [
[
self.kernel_name.as_ref(),
self.nodename.as_ref(),
self.kernel_release.as_ref(),
self.kernel_version.as_ref(),
self.machine.as_ref(),
self.os.as_ref(),
self.processor.as_ref(),
self.hardware_platform.as_ref(),
self.os.as_ref(),
]
.into_iter()
.flatten()
{
output.push_str(name);
output.push(' ');
}
output
.map(|name| name.as_str())
.collect::<Vec<_>>()
.join(" ")
}

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

Expand Down
Loading