@@ -4,42 +4,36 @@ use std::fmt;
44
55#[ derive( Debug ) ]
66pub enum InstructionError {
7- GlobalNotFound ,
8- LocalNotFound ,
9- UnmatchedInstruction ,
10- InvalidOperation ( Instruction ) ,
7+ GlobalNotFound ,
8+ LocalNotFound ,
9+ UnmatchedInstruction ,
10+ InvalidOperation ( Instruction ) ,
1111}
1212
1313impl fmt:: Display for InstructionError {
14- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
15- match self {
16- InstructionError :: GlobalNotFound =>
17- write ! ( f, "Global not found" ) ,
18- InstructionError :: LocalNotFound =>
19- write ! ( f, "Local not found" ) ,
20- InstructionError :: UnmatchedInstruction =>
21- write ! ( f, "Unmatched instruction" ) ,
22- InstructionError :: InvalidOperation ( i) =>
23- write ! ( f, "{}" , format!( "Invalid operation: {:?}" , i) . as_str( ) ) ,
24- }
25- }
14+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
15+ match self {
16+ InstructionError :: GlobalNotFound => write ! ( f, "Global not found" ) ,
17+ InstructionError :: LocalNotFound => write ! ( f, "Local not found" ) ,
18+ InstructionError :: UnmatchedInstruction => write ! ( f, "Unmatched instruction" ) ,
19+ InstructionError :: InvalidOperation ( i) => {
20+ write ! ( f, "{}" , format!( "Invalid operation: {:?}" , i) . as_str( ) )
21+ }
22+ }
23+ }
2624}
2725
2826impl error:: Error for InstructionError {
29- fn description ( & self ) -> & str {
30- match self {
31- InstructionError :: GlobalNotFound =>
32- "Global not found" ,
33- InstructionError :: LocalNotFound =>
34- "Local not found" ,
35- InstructionError :: UnmatchedInstruction =>
36- "Unmatched instruction" ,
37- InstructionError :: InvalidOperation ( _) =>
38- "Invalid operation"
39- }
40- }
27+ fn description ( & self ) -> & str {
28+ match self {
29+ InstructionError :: GlobalNotFound => "Global not found" ,
30+ InstructionError :: LocalNotFound => "Local not found" ,
31+ InstructionError :: UnmatchedInstruction => "Unmatched instruction" ,
32+ InstructionError :: InvalidOperation ( _) => "Invalid operation" ,
33+ }
34+ }
4135
42- fn cause ( & self ) -> Option < & error:: Error > {
43- None
44- }
36+ fn cause ( & self ) -> Option < & error:: Error > {
37+ None
38+ }
4539}
0 commit comments