1+ #![ allow( clippy:: needless_pass_by_value) ]
12use super :: utils:: logitems:: { ItemBatch , LogEntry } ;
23use crate :: {
34 components:: {
@@ -191,7 +192,7 @@ impl CommitList {
191192 format ! ( "{}^..{}" , f. hash_short, l. hash_short) ;
192193 if let Err ( e) = crate :: clipboard:: copy_string ( & yank) {
193194 self . queue . push ( InternalEvent :: ShowErrorMsg (
194- copy_fail ( e. to_string ( ) ) ,
195+ copy_fail ( & e. to_string ( ) ) ,
195196 ) ) ;
196197 return Err ( e) ;
197198 }
@@ -215,7 +216,7 @@ impl CommitList {
215216
216217 if let Err ( e) = crate :: clipboard:: copy_string ( & separate) {
217218 self . queue . push ( InternalEvent :: ShowErrorMsg (
218- copy_fail ( e. to_string ( ) ) ,
219+ copy_fail ( & e. to_string ( ) ) ,
219220 ) ) ;
220221 return Err ( e) ;
221222 }
@@ -238,7 +239,7 @@ impl CommitList {
238239 crate :: clipboard:: copy_string ( & e. hash_short )
239240 {
240241 self . queue . push ( InternalEvent :: ShowErrorMsg (
241- copy_fail ( e. to_string ( ) ) ,
242+ copy_fail ( & e. to_string ( ) ) ,
242243 ) ) ;
243244 return Err ( e) ;
244245 }
@@ -255,7 +256,7 @@ impl CommitList {
255256 crate :: clipboard:: copy_string ( & e. hash_short )
256257 {
257258 self . queue . push ( InternalEvent :: ShowErrorMsg (
258- copy_fail ( e. to_string ( ) ) ,
259+ copy_fail ( & e. to_string ( ) ) ,
259260 ) ) ;
260261 return Err ( e) ;
261262 }
@@ -406,7 +407,7 @@ impl CommitList {
406407 txt. push ( splitter. clone ( ) ) ;
407408
408409 let author_width =
409- ( width. saturating_sub ( 19 ) / 3 ) . max ( 3 ) . min ( 20 ) ;
410+ ( width. saturating_sub ( 19 ) / 3 ) . clamp ( 3 , 20 ) ;
410411 let author = string_width_align ( & e. author , author_width) ;
411412
412413 // commit author
@@ -418,18 +419,14 @@ impl CommitList {
418419 txt. push ( splitter. clone ( ) ) ;
419420
420421 // commit tags
421- if let Some ( tags) = tags {
422- txt. push ( splitter. clone ( ) ) ;
423- txt. push ( Span :: styled ( tags, theme. tags ( selected) ) ) ;
424- }
425-
426- if let Some ( branches) = branches {
427- txt. push ( splitter. clone ( ) ) ;
428- txt. push ( Span :: styled (
429- branches,
430- theme. branch ( selected, true ) ,
431- ) ) ;
432- }
422+ txt. push ( Span :: styled (
423+ Cow :: from (
424+ tags. map_or_else ( String :: new, |tags| {
425+ format ! ( " {tags}" )
426+ } ) ,
427+ ) ,
428+ theme. tags ( selected) ,
429+ ) ) ;
433430
434431 txt. push ( splitter) ;
435432
@@ -439,7 +436,7 @@ impl CommitList {
439436
440437 // commit msg
441438 txt. push ( Span :: styled (
442- format ! ( "{:w $}" , & e. msg, w = message_width ) ,
439+ format ! ( "{:message_width $}" , & e. msg) ,
443440 theme. text ( true , selected) ,
444441 ) ) ;
445442
@@ -474,7 +471,7 @@ impl CommitList {
474471 let branches = self . branches . get ( & e. id ) . map ( |names| {
475472 names
476473 . iter ( )
477- . map ( |name| format ! ( "{{{}}}" , name ) )
474+ . map ( |name| format ! ( "{{{name }}}" ) )
478475 . join ( " " )
479476 } ) ;
480477
@@ -542,7 +539,7 @@ impl DrawableComponent for CommitList {
542539 ) ) ;
543540
544541 let branch_post_fix =
545- self . branch . as_ref ( ) . map ( |b| format ! ( "- {{{}}}" , b ) ) ;
542+ self . branch . as_ref ( ) . map ( |b| format ! ( "- {{{b }}}" ) ) ;
546543
547544 let title = format ! (
548545 "{} {}/{} {}" ,
0 commit comments