diff --git a/.clippy.toml b/.clippy.toml index ec0fa1f1c..e9b576d3a 100644 --- a/.clippy.toml +++ b/.clippy.toml @@ -1,2 +1,2 @@ # Specify the minimum supported Rust version -msrv = "1.57.0" +msrv = "1.64.0" diff --git a/src/bindgen/config.rs b/src/bindgen/config.rs index 9acc5bd1f..5012414b7 100644 --- a/src/bindgen/config.rs +++ b/src/bindgen/config.rs @@ -61,8 +61,10 @@ impl Language { /// Controls what type of line endings are used in the generated code. #[derive(Debug, Clone, Copy)] #[allow(clippy::upper_case_acronyms)] +#[derive(Default)] pub enum LineEndingStyle { /// Use Unix-style linefeed characters + #[default] LF, /// Use classic Mac-style carriage-return characters CR, @@ -72,12 +74,6 @@ pub enum LineEndingStyle { Native, } -impl Default for LineEndingStyle { - fn default() -> Self { - LineEndingStyle::LF - } -} - impl LineEndingStyle { pub fn as_str(&self) -> &'static str { match self { @@ -213,8 +209,9 @@ impl FromStr for DocumentationLength { deserialize_enum_str!(DocumentationLength); /// A style of Style to use when generating structs and enums. -#[derive(Debug, Copy, Clone, PartialEq, Eq)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Default)] pub enum Style { + #[default] Both, Tag, Type, @@ -245,12 +242,6 @@ impl Style { } } -impl Default for Style { - fn default() -> Self { - Style::Both - } -} - impl FromStr for Style { type Err = String; diff --git a/src/bindgen/ir/repr.rs b/src/bindgen/ir/repr.rs index 971320187..4382be392 100644 --- a/src/bindgen/ir/repr.rs +++ b/src/bindgen/ir/repr.rs @@ -6,19 +6,14 @@ use syn::ext::IdentExt; use crate::bindgen::ir::ty::{IntKind, PrimitiveType}; -#[derive(Debug, Copy, Clone, PartialEq, Eq)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Default)] pub enum ReprStyle { + #[default] Rust, C, Transparent, } -impl Default for ReprStyle { - fn default() -> Self { - ReprStyle::Rust - } -} - #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub struct ReprType { kind: IntKind, diff --git a/src/bindgen/rename.rs b/src/bindgen/rename.rs index e58b7a5ae..f594939e8 100644 --- a/src/bindgen/rename.rs +++ b/src/bindgen/rename.rs @@ -28,9 +28,10 @@ impl<'a> IdentifierType<'a> { } /// A rule to apply to an identifier when generating bindings. -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone, Copy, Default)] pub enum RenameRule { /// Do not apply any renaming. The default. + #[default] None, /// Converts the identifier to PascalCase and adds a context dependent prefix GeckoCase, @@ -93,12 +94,6 @@ impl RenameRule { } } -impl Default for RenameRule { - fn default() -> RenameRule { - RenameRule::None - } -} - impl FromStr for RenameRule { type Err = String; diff --git a/tests/depfile.rs b/tests/depfile.rs index 8dc1859f3..7d629f35d 100644 --- a/tests/depfile.rs +++ b/tests/depfile.rs @@ -93,7 +93,6 @@ fn test_project(project_path: &str) { ); std::fs::remove_dir_all(build_dir).expect("Failed to remove old build directory"); - () } macro_rules! test_file { diff --git a/tests/tests.rs b/tests/tests.rs index d978bd0b1..3846f326e 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -251,7 +251,7 @@ fn run_compile_test( ); if generate_depfile { let depfile = depfile_contents.expect("No depfile generated"); - assert!(depfile.len() > 0); + assert!(!depfile.is_empty()); let mut rules = depfile.split(':'); let target = rules.next().expect("No target found"); assert_eq!(target, generated_file.as_os_str().to_str().unwrap());