File tree Expand file tree Collapse file tree 5 files changed +24
-4
lines changed Expand file tree Collapse file tree 5 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -92,8 +92,8 @@ impl fmt::Display for ConfError {
9292
9393impl Error for ConfError { }
9494
95- fn conf_error ( s : String ) -> Box < dyn Error > {
96- Box :: new ( ConfError ( s) )
95+ fn conf_error ( s : impl Into < String > ) -> Box < dyn Error > {
96+ Box :: new ( ConfError ( s. into ( ) ) )
9797}
9898
9999macro_rules! define_Conf {
@@ -154,7 +154,13 @@ macro_rules! define_Conf {
154154 $name = Some ( value) ;
155155 // $new_conf is the same as one of the defined `$name`s, so
156156 // this variable is defined in line 2 of this function.
157- $( $new_conf = Some ( value) ; ) ?
157+ $( match $new_conf {
158+ Some ( _) => errors. push( conf_error( concat!(
159+ "duplicate field `" , stringify!( $new_conf) ,
160+ "` (provided as `" , stringify!( $name) , "`)"
161+ ) ) ) ,
162+ None => $new_conf = Some ( value) ,
163+ } ) ?
158164 } ,
159165 }
160166 }
Original file line number Diff line number Diff line change 1- # that one is an error
1+ # that one is a warning
22cyclomatic-complexity-threshold = 2
33
44# that one is white-listed
Original file line number Diff line number Diff line change 1+ cognitive-complexity-threshold = 2
2+ # This is the deprecated name for the same key
3+ cyclomatic-complexity-threshold = 3
4+ # Check we get duplication warning regardless of order
5+ cognitive-complexity-threshold = 4
Original file line number Diff line number Diff line change 1+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error: error reading Clippy's configuration file `$DIR/clippy.toml`: duplicate field `cognitive_complexity_threshold` (provided as `cyclomatic_complexity_threshold`)
2+
3+ error: error reading Clippy's configuration file `$DIR/clippy.toml`: duplicate field `cognitive-complexity-threshold`
4+
5+ warning: error reading Clippy's configuration file `$DIR/clippy.toml`: deprecated field `cyclomatic-complexity-threshold`. Please use `cognitive-complexity-threshold` instead
6+
7+ error: aborting due to 2 previous errors; 1 warning emitted
8+
You can’t perform that action at this time.
0 commit comments