File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,24 +38,21 @@ pub struct UNameOutput {
3838
3939impl 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
You can’t perform that action at this time.
0 commit comments