File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -110,8 +110,8 @@ pub struct LogAccess<'a>(RefMut<'a, Vec<String>>);
110
110
111
111
impl < ' a > LogAccess < ' a > {
112
112
/// Adds a message to the logs
113
- pub fn add ( & mut self , msg : String ) {
114
- self . 0 . push ( msg) ;
113
+ pub fn add ( & mut self , msg : impl Into < String > ) {
114
+ self . 0 . push ( msg. into ( ) ) ;
115
115
}
116
116
}
117
117
@@ -409,18 +409,16 @@ mod tests {
409
409
fn logs_works ( ) {
410
410
let mut logs = Logs :: new ( ) ;
411
411
412
- if let Some ( mut logs) = logs. open ( ) {
413
- logs. add ( format ! ( "a test" ) ) ;
414
- }
412
+ logs. add ( || "a test" . to_string ( ) ) ;
415
413
416
414
if let Some ( mut logs) = logs. open ( ) {
417
- logs. add ( format ! ( "second test" ) ) ;
418
- logs. add ( format ! ( "third test" ) ) ;
415
+ logs. add ( "second test" ) ;
416
+ logs. add ( "third test" ) ;
419
417
}
420
418
421
419
let mut logs_b = logs. clone ( ) ;
422
420
if let Some ( mut logs) = logs_b. open ( ) {
423
- logs. add ( format ! ( "added in b" ) ) ;
421
+ logs. add ( "added in b" ) ;
424
422
}
425
423
426
424
let mut iter = logs. into_iter ( ) ;
You can’t perform that action at this time.
0 commit comments