@@ -40,6 +40,8 @@ const DEFAULT_DOC_VALID_IDENTS: &[&str] = &[
40
40
const DEFAULT_DISALLOWED_NAMES : & [ & str ] = & [ "foo" , "baz" , "quux" ] ;
41
41
const DEFAULT_ALLOWED_IDENTS_BELOW_MIN_CHARS : & [ & str ] = & [ "i" , "j" , "x" , "y" , "z" , "w" , "n" ] ;
42
42
const DEFAULT_ALLOWED_PREFIXES : & [ & str ] = & [ "to" , "as" , "into" , "from" , "try_into" , "try_from" ] ;
43
+ const DEFAULT_ALLOWED_TRAITS_WITH_RENAMED_PARAMS : & [ & str ] =
44
+ & [ "core::convert::From" , "core::convert::TryFrom" , "core::str::FromStr" ] ;
43
45
44
46
/// Conf with parse errors
45
47
#[ derive( Default ) ]
@@ -455,6 +457,10 @@ define_Conf! {
455
457
///
456
458
/// Whether `unwrap` should be allowed in test functions or `#[cfg(test)]`
457
459
( allow_unwrap_in_tests: bool = false ) ,
460
+ /// Lint: PANIC.
461
+ ///
462
+ /// Whether `panic` should be allowed in test functions or `#[cfg(test)]`
463
+ ( allow_panic_in_tests: bool = false ) ,
458
464
/// Lint: DBG_MACRO.
459
465
///
460
466
/// Whether `dbg!` should be allowed in test functions or `#[cfg(test)]`
@@ -613,6 +619,27 @@ define_Conf! {
613
619
/// - Use `".."` as part of the list to indicate that the configured values should be appended to the
614
620
/// default configuration of Clippy. By default, any configuration will replace the default value
615
621
( allowed_prefixes: Vec <String > = DEFAULT_ALLOWED_PREFIXES . iter( ) . map( ToString :: to_string) . collect( ) ) ,
622
+ /// Lint: RENAMED_FUNCTION_PARAMS.
623
+ ///
624
+ /// List of trait paths to ignore when checking renamed function parameters.
625
+ ///
626
+ /// #### Example
627
+ ///
628
+ /// ```toml
629
+ /// allow-renamed-params-for = [ "std::convert::From" ]
630
+ /// ```
631
+ ///
632
+ /// #### Noteworthy
633
+ ///
634
+ /// - By default, the following traits are ignored: `From`, `TryFrom`, `FromStr`
635
+ /// - `".."` can be used as part of the list to indicate that the configured values should be appended to the
636
+ /// default configuration of Clippy. By default, any configuration will replace the default value.
637
+ ( allow_renamed_params_for: Vec <String > =
638
+ DEFAULT_ALLOWED_TRAITS_WITH_RENAMED_PARAMS . iter( ) . map( ToString :: to_string) . collect( ) ) ,
639
+ /// Lint: MACRO_METAVARS_IN_UNSAFE.
640
+ ///
641
+ /// Whether to also emit warnings for unsafe blocks with metavariable expansions in **private** macros.
642
+ ( warn_unsafe_macro_metavars_in_private_macros: bool = false ) ,
616
643
}
617
644
618
645
/// Search for the configuration file.
@@ -674,6 +701,10 @@ fn deserialize(file: &SourceFile) -> TryConf {
674
701
extend_vec_if_indicator_present ( & mut conf. conf . doc_valid_idents , DEFAULT_DOC_VALID_IDENTS ) ;
675
702
extend_vec_if_indicator_present ( & mut conf. conf . disallowed_names , DEFAULT_DISALLOWED_NAMES ) ;
676
703
extend_vec_if_indicator_present ( & mut conf. conf . allowed_prefixes , DEFAULT_ALLOWED_PREFIXES ) ;
704
+ extend_vec_if_indicator_present (
705
+ & mut conf. conf . allow_renamed_params_for ,
706
+ DEFAULT_ALLOWED_TRAITS_WITH_RENAMED_PARAMS ,
707
+ ) ;
677
708
// TODO: THIS SHOULD BE TESTED, this comment will be gone soon
678
709
if conf. conf . allowed_idents_below_min_chars . contains ( ".." ) {
679
710
conf. conf
0 commit comments