File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,11 +26,18 @@ pub enum StoreError {
2626impl core:: fmt:: Display for StoreError {
2727 fn fmt ( & self , f : & mut core:: fmt:: Formatter < ' _ > ) -> core:: fmt:: Result {
2828 match self {
29- Self :: Io ( e) => write ! ( f, "io error trying to read file: {e}" ) ,
30- Self :: InvalidMagicBytes { got, expected } => write ! (
31- f,
32- "file has invalid magic bytes: expected={expected:?} got={got:?}" ,
33- ) ,
29+ Self :: Io ( e) => write ! ( f, "io error trying to read file: {}" , e) ,
30+ Self :: InvalidMagicBytes { got, expected } => {
31+ write ! ( f, "file has invalid magic bytes: expected=0x" ) ?;
32+ for b in expected {
33+ write ! ( f, "{:02x}" , b) ?;
34+ }
35+ write ! ( f, " got=0x" ) ?;
36+ for b in got {
37+ write ! ( f, "{:02x}" , b) ?;
38+ }
39+ Ok ( ( ) )
40+ }
3441 Self :: Bincode ( e) => write ! ( f, "bincode error while reading entry {e}" ) ,
3542 }
3643 }
You can’t perform that action at this time.
0 commit comments