@@ -2,44 +2,39 @@ use crate::std::string::String;
22use crate :: std:: vec;
33use crate :: std:: vec:: Vec ;
44
5- #[ cfg( feature = "std" ) ]
65use thiserror:: Error ;
76
87use crate :: Bar ;
98
109/// Errors that can occur during decoding.
11- #[ derive( Debug , PartialEq ) ]
12- #[ cfg_attr( feature = "std" , derive( Error ) ) ]
10+ #[ derive( Debug , PartialEq , Error ) ]
1311pub enum DecodingError {
1412 /// A sequence of modules resulted in an unknown pattern.
15- #[ cfg_attr ( feature = "std" , error( "pattern {0:b} not recognized" ) ) ]
13+ #[ error( "pattern {0:b} not recognized" ) ]
1614 Pattern ( u16 ) ,
1715 /// A bar's width or spacing is not valid.
18- #[ cfg_attr ( feature = "std" , error( "bar is not valid" ) ) ]
16+ #[ error( "bar is not valid" ) ]
1917 InvalidBar ,
2018 /// The stop code at the end is wrong.
21- #[ cfg_attr ( feature = "std" , error( "wrong stop code" ) ) ]
19+ #[ error( "wrong stop code" ) ]
2220 WrongStop ,
2321 /// The input was too short.
24- #[ cfg_attr ( feature = "std" , error( "code too short to be valid" ) ) ]
22+ #[ error( "code too short to be valid" ) ]
2523 Short ,
2624 /// The code's length can not fit an allowed sequence of modules.
27- #[ cfg_attr ( feature = "std" , error( "length not correct" ) ) ]
25+ #[ error( "length not correct" ) ]
2826 Length ,
2927 /// The checksum did not match.
30- #[ cfg_attr ( feature = "std" , error( "checksum mismatch" ) ) ]
28+ #[ error( "checksum mismatch" ) ]
3129 Checksum ,
3230 /// The code did not start with a mode signal.
33- #[ cfg_attr ( feature = "std" , error( "start char did not signal mode" ) ) ]
31+ #[ error( "start char did not signal mode" ) ]
3432 NoMode ,
3533 /// A symbol occurred in a mode that did not support it or is not implemented.
36- #[ cfg_attr ( feature = "std" , error( "unexpected character {0:x}" ) ) ]
34+ #[ error( "unexpected character {0:x}" ) ]
3735 Unexpected ( u8 ) ,
3836 /// After decoding the data the conversion from Latin 1 failed.
39- #[ cfg_attr(
40- feature = "std" ,
41- error( "characters not covered by Latin 1 were part of this symbol" )
42- ) ]
37+ #[ error( "characters not covered by Latin 1 were part of this symbol" ) ]
4338 Latin1 ,
4439}
4540
0 commit comments