@@ -415,7 +415,7 @@ mod tests {
415415
416416 // Verify all characters have codes
417417 for ch in text. chars ( ) {
418- assert ! ( codes. contains_key( & ch) , "Missing code for '{}'" , ch ) ;
418+ assert ! ( codes. contains_key( & ch) , "Missing code for '{ch }'" ) ;
419419 }
420420
421421 // Verify decoding returns original text
@@ -436,17 +436,17 @@ mod tests {
436436 for text in test_cases {
437437 let ( encoded, codes) = huffman_encode ( text) ;
438438 let decoded = huffman_decode ( & encoded, & codes) ;
439- assert_eq ! ( decoded, text, "Failed roundtrip for: '{}'" , text ) ;
439+ assert_eq ! ( decoded, text, "Failed roundtrip for: '{text }'" ) ;
440440 }
441441 }
442442
443443 #[ test]
444444 fn test_frequency_based_encoding ( ) {
445445 // In "aaabbc", 'a' should have shorter code than 'b' or 'c'
446446 let ( _, codes) = huffman_encode ( "aaabbc" ) ;
447- let a_len = codes. get ( & 'a' ) . unwrap ( ) . len ( ) ;
448- let b_len = codes. get ( & 'b' ) . unwrap ( ) . len ( ) ;
449- let c_len = codes. get ( & 'c' ) . unwrap ( ) . len ( ) ;
447+ let a_len = codes[ & 'a' ] . len ( ) ;
448+ let b_len = codes[ & 'b' ] . len ( ) ;
449+ let c_len = codes[ & 'c' ] . len ( ) ;
450450
451451 // 'a' appears most frequently, so should have shortest or equal code
452452 assert ! ( a_len <= b_len) ;
@@ -513,7 +513,7 @@ mod tests {
513513 assert ! ( result. is_ok( ) ) ;
514514
515515 // Clean up
516- std:: fs:: remove_file ( test_file) . ok ( ) ;
516+ let _ = std:: fs:: remove_file ( test_file) ;
517517 }
518518
519519 #[ test]
@@ -529,7 +529,7 @@ mod tests {
529529 assert ! ( result. is_ok( ) ) ;
530530
531531 // Clean up
532- std:: fs:: remove_file ( test_file) . ok ( ) ;
532+ let _ = std:: fs:: remove_file ( test_file) ;
533533 }
534534}
535535
0 commit comments