mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
uname: remove unnecessary mut & trim_end() call
This commit is contained in:
parent
0835fc61eb
commit
05bcb65b26
1 changed files with 5 additions and 8 deletions
|
@ -38,8 +38,7 @@ 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(),
|
||||
|
@ -51,11 +50,9 @@ impl UNameOutput {
|
|||
]
|
||||
.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> {
|
||||
|
@ -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(())
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue