From bc29ebb274a8922e3c7f0049f720efaf0e90864b Mon Sep 17 00:00:00 2001 From: SupperZum Date: Mon, 17 Mar 2025 14:32:15 +0200 Subject: [PATCH 1/4] fix new clippy --- module/core/clone_dyn_types/src/lib.rs | 2 +- module/core/former_meta/src/derive_former.rs | 28 ++++----- .../former_meta/src/derive_former/field.rs | 62 +++++++++---------- .../src/derive_former/field_attrs.rs | 20 +++--- .../src/derive_former/struct_attrs.rs | 4 +- module/move/wca/benches/bench.rs | 2 +- module/move/wca/src/ca/verifier/verifier.rs | 2 +- 7 files changed, 58 insertions(+), 62 deletions(-) diff --git a/module/core/clone_dyn_types/src/lib.rs b/module/core/clone_dyn_types/src/lib.rs index 68fdff07d4..388d72ca98 100644 --- a/module/core/clone_dyn_types/src/lib.rs +++ b/module/core/clone_dyn_types/src/lib.rs @@ -190,7 +190,7 @@ mod private unsafe { let mut ptr = ref_dyn as *const T; - let data_ptr = &mut ptr as *mut *const T as *mut *mut (); + let data_ptr = &raw mut ptr as *mut *mut (); *data_ptr = < T as CloneDyn >::__clone_dyn( ref_dyn, DontCallMe ); Box::from_raw( ptr as *mut T ) } diff --git a/module/core/former_meta/src/derive_former.rs b/module/core/former_meta/src/derive_former.rs index e8a166e3d6..61549a8fe9 100644 --- a/module/core/former_meta/src/derive_former.rs +++ b/module/core/former_meta/src/derive_former.rs @@ -1,6 +1,6 @@ #[ allow( clippy::wildcard_imports ) ] use super::*; -use iter_tools::{ Itertools }; +use iter_tools::Itertools; use macro_tools::{ attr, diag, generic_params, generic_args, typ, derive, Result }; use proc_macro2::TokenStream; @@ -77,7 +77,7 @@ pub fn mutator { let debug = format! ( - r#" + r" = Example of custom mutator impl< {} > former::FormerMutator @@ -91,7 +91,7 @@ where {{ }} }} - "#, + ", format!( "{}", qt!{ #former_definition_types_generics_impl } ), format!( "{}", qt!{ #former_definition_types_generics_ty } ), format!( "{}", qt!{ #former_definition_types_generics_where } ), @@ -99,8 +99,8 @@ where // println!( "{debug}" ); let about = format! ( -r#"derive : Former -item : {item}"#, +r"derive : Former +item : {item}", ); diag::report_print( about, original_input, debug ); }; @@ -116,18 +116,18 @@ fn doc_generate( item : &syn::Ident ) -> ( String, String ) let doc_former_mod = format! ( -r#" Implementation of former for [{item}]. -"# +r" Implementation of former for [{item}]. +" ); let doc_former_struct = format! ( -r#" +r" Structure to form [{item}]. Represents a forming entity designed to construct objects through a builder pattern. This structure holds temporary storage and context during the formation process and utilizes a defined end strategy to finalize the object creation. -"# +" ); ( doc_former_mod, doc_former_struct ) @@ -144,11 +144,7 @@ pub fn former( input : proc_macro::TokenStream ) -> Result< TokenStream > use macro_tools::IntoGenericArgs; let original_input = input.clone(); - let ast = match syn::parse::< syn::DeriveInput >( input ) - { - Ok( syntax_tree ) => syntax_tree, - Err( err ) => return Err( err ), - }; + let ast = syn::parse::< syn::DeriveInput >( input )?; let has_debug = attr::has_debug( ast.attrs.iter() )?; let struct_attrs = ItemAttributes::from_attrs( ast.attrs.iter() )?; @@ -165,12 +161,12 @@ pub fn former( input : proc_macro::TokenStream ) -> Result< TokenStream > let as_subformer_end_doc = format! ( - r#" + r" Represents an end condition for former of [`${item}`], tying the lifecycle of forming processes to a broader context. This trait is intended for use with subformer alias, ensuring that end conditions are met according to the specific needs of the broader forming context. It mandates the implementation of `former::FormingEnd`. - "# + " ); /* parameters for structure */ diff --git a/module/core/former_meta/src/derive_former/field.rs b/module/core/former_meta/src/derive_former/field.rs index c5b398f7cf..34a80bc769 100644 --- a/module/core/former_meta/src/derive_former/field.rs +++ b/module/core/former_meta/src/derive_former/field.rs @@ -1,6 +1,6 @@ #[ allow( clippy::wildcard_imports ) ] use super::*; -use macro_tools::{ container_kind }; +use macro_tools::container_kind; /// /// Definition of a field. @@ -455,7 +455,7 @@ impl< 'a > FormerField< 'a > { let debug = format! ( - r#" + r" impl< Definition > {former}< Definition > where Definition : former::FormerDefinition< Storage = {former_storage} >, @@ -470,14 +470,14 @@ where self }} }} - "#, + ", format!( "{}", qt!{ #typ } ), ); let about = format! ( -r#"derive : Former +r"derive : Former item : {item} -field : {field_ident}"#, +field : {field_ident}", ); diag::report_print( about, original_input, debug ); } @@ -693,7 +693,7 @@ field : {field_ident}"#, { let debug = format! ( - r#" + r" /// The collection setter provides a collection setter that returns a CollectionFormer tailored for managing a collection of child entities. It employs a generic collection definition to facilitate operations on the entire collection, such as adding or updating elements. impl< Definition, > {former}< Definition, > @@ -713,14 +713,14 @@ where }} }} - "#, + ", format!( "{}", qt!{ #( #params, )* } ), ); let about = format! ( -r#"derive : Former +r"derive : Former item : {item} -field : {field_ident}"#, +field : {field_ident}", ); diag::report_print( about, original_input, debug ); } @@ -736,13 +736,13 @@ field : {field_ident}"#, let subform_collection_end_doc = format! ( - r#" + r" A callback structure to manage the final stage of forming a `{0}` for the `{item}` collection. This callback is used to integrate the contents of a temporary `{0}` back into the original `{item}` former after the subforming process is completed. It replaces the existing content of the `{field_ident}` field in `{item}` with the new content generated during the subforming process. - "#, + ", format!( "{}", qt!{ #field_typ } ), ); @@ -891,7 +891,7 @@ with the new content generated during the subforming process. let doc = format! ( - r#" + r" Initiates the addition of {field_ident} to the `{item}` entity using a dedicated subformer. @@ -905,7 +905,7 @@ parent's structure once formed. Returns an instance of `Former2`, a subformer ready to begin the formation process for `{0}` entities, allowing for dynamic and flexible construction of the `{item}` entity's {field_ident}. - "#, + ", format!( "{}", qt!{ #field_typ } ), ); @@ -946,7 +946,7 @@ allowing for dynamic and flexible construction of the `{item}` entity's {field_i let doc = format! ( - r#" + r" Provides a user-friendly interface to add an instancce of {field_ident} to the {item}. # Returns @@ -954,7 +954,7 @@ Provides a user-friendly interface to add an instancce of {field_ident} to the { Returns an instance of `Former2`, a subformer ready to begin the formation process for `{0}` entities, allowing for dynamic and flexible construction of the `{item}` entity's {field_ident}. - "#, + ", format!( "{}", qt!{ #field_typ } ), ); @@ -998,7 +998,7 @@ allowing for dynamic and flexible construction of the `{item}` entity's {field_i { let debug = format! ( - r#" + r" /// Initializes and configures a subformer for adding named child entities. This method leverages an internal function /// to create and return a configured subformer instance. It allows for the dynamic addition of children with specific names, /// integrating them into the formation process of the parent entity. @@ -1016,21 +1016,21 @@ where // Replace {0} with name of type of entry value. }} - "#, + ", format!( "{}", qt!{ #entry_typ } ), ); let about = format! ( -r#"derive : Former +r"derive : Former item : {item} -field : {field_ident}"#, +field : {field_ident}", ); diag::report_print( about, original_input, debug ); } let doc = format! ( - r#" + r" Implements the `FormingEnd` trait for `{subform_entry_end}` to handle the final stage of the forming process for a `{item}` collection that contains `{0}` elements. @@ -1058,7 +1058,7 @@ preformed elements to this storage. Returns the updated `{former}` instance with newly added {field_ident}, completing the formation process of the `{item}`. - "#, + ", format!( "{}", qt!{ #field_typ } ), ); @@ -1179,7 +1179,7 @@ formation process of the `{item}`. let doc = format! ( - r#" + r" Initiates the scalar subformer for a `{0}` entity within a `{item}`. @@ -1203,7 +1203,7 @@ is properly initialized with all necessary configurations, including the default This function is typically called internally by a more user-friendly method that abstracts away the complex generics, providing a cleaner interface for initiating subform operations on scalar fields. - "#, + ", format!( "{}", qt!{ #field_typ } ), ); @@ -1267,7 +1267,7 @@ generics, providing a cleaner interface for initiating subform operations on sca let doc = format! ( - r#" + r" Provides a user-friendly interface to begin subforming a scalar `{0}` field within a `{item}`. This method abstracts the underlying complex generics involved in setting up the former, simplifying the @@ -1277,7 +1277,7 @@ This method utilizes the more generic `{subform_scalar}` method to set up and re providing a straightforward and type-safe interface for client code. It encapsulates details about the specific former and end action types, ensuring a seamless developer experience when forming parts of a `{item}`. - "#, + ", format!( "{}", qt!{ #field_typ } ), ); @@ -1320,7 +1320,7 @@ former and end action types, ensuring a seamless developer experience when formi { let debug = format! ( - r#" + r" /// Extends `{former}` to include a method that initializes and configures a subformer for the '{field_ident}' field. /// This function demonstrates the dynamic addition of a named {field_ident}, leveraging a subformer to specify detailed properties. @@ -1334,21 +1334,21 @@ where self._{field_ident}_subform_scalar::< {0}Former< _ >, _, >().name( name ) }} }} - "#, + ", format!( "{}", qt!{ #field_typ } ), ); let about = format! ( -r#"derive : Former +r"derive : Former item : {item} -field : {field_ident}"#, +field : {field_ident}", ); diag::report_print( about, original_input, debug ); } let doc = format! ( - r#" + r" Represents the endpoint for the forming process of a scalar field managed by a subformer within a `{item}` entity. @@ -1366,7 +1366,7 @@ Essentially, this end action integrates the individually formed scalar value bac - `super_former`: An optional context of the `{former}`, which will receive the value. The function ensures that this context is not `None` and inserts the formed value into the designated field within `{item}`'s storage. - "#, + ", format!( "{}", qt!{ #field_typ } ), ); diff --git a/module/core/former_meta/src/derive_former/field_attrs.rs b/module/core/former_meta/src/derive_former/field_attrs.rs index 7f97619d9a..a2971f46a5 100644 --- a/module/core/former_meta/src/derive_former/field_attrs.rs +++ b/module/core/former_meta/src/derive_former/field_attrs.rs @@ -206,10 +206,10 @@ impl syn::parse::Parse for AttributeConfig syn_err! ( ident, - r#"Expects an attribute of format '#[ former( default = 13 ) ]' + r"Expects an attribute of format '#[ former( default = 13 ) ]' {known} But got: '{}' -"#, +", qt!{ #ident } ) }; @@ -368,10 +368,10 @@ impl syn::parse::Parse for AttributeScalarSetter syn_err! ( ident, - r#"Expects an attribute of format '#[ scalar( name = myName, setter = true ) ]' + r"Expects an attribute of format '#[ scalar( name = myName, setter = true ) ]' {known} But got: '{}' -"#, +", qt!{ #ident } ) }; @@ -544,10 +544,10 @@ impl syn::parse::Parse for AttributeSubformScalarSetter syn_err! ( ident, - r#"Expects an attribute of format '#[ subform_scalar( name = myName, setter = true ) ]' + r"Expects an attribute of format '#[ subform_scalar( name = myName, setter = true ) ]' {known} But got: '{}' -"#, +", qt!{ #ident } ) }; @@ -735,10 +735,10 @@ impl syn::parse::Parse for AttributeSubformCollectionSetter syn_err! ( ident, - r#"Expects an attribute of format '#[ subform_collection( name = myName, setter = true, debug, definition = MyDefinition ) ]' + r"Expects an attribute of format '#[ subform_collection( name = myName, setter = true, debug, definition = MyDefinition ) ]' {known} But got: '{}' -"#, +", qt!{ #ident } ) }; @@ -919,10 +919,10 @@ impl syn::parse::Parse for AttributeSubformEntrySetter syn_err! ( ident, - r#"Expects an attribute of format '#[ subform( name = myName, setter = true ) ]' + r"Expects an attribute of format '#[ subform( name = myName, setter = true ) ]' {known} But got: '{}' -"#, +", qt!{ #ident } ) }; diff --git a/module/core/former_meta/src/derive_former/struct_attrs.rs b/module/core/former_meta/src/derive_former/struct_attrs.rs index 3d01240657..4647f14c6d 100644 --- a/module/core/former_meta/src/derive_former/struct_attrs.rs +++ b/module/core/former_meta/src/derive_former/struct_attrs.rs @@ -347,10 +347,10 @@ impl syn::parse::Parse for AttributeMutator syn_err! ( ident, - r#"Expects an attribute of format '#[ mutator( custom ) ]' + r"Expects an attribute of format '#[ mutator( custom ) ]' {known} But got: '{}' -"#, +", qt!{ #ident } ) }; diff --git a/module/move/wca/benches/bench.rs b/module/move/wca/benches/bench.rs index 45469b2476..8b05ccf91d 100644 --- a/module/move/wca/benches/bench.rs +++ b/module/move/wca/benches/bench.rs @@ -77,7 +77,7 @@ fn initialize_commands_with_properties( count : usize ) -> CommandsAggregator fn run_commands< S : AsRef< str > >( ca : CommandsAggregator, command : S ) { - ca.perform( command.as_ref() ).unwrap() + ca.perform( command.as_ref() ).unwrap(); } fn benchmark_initialize_thousand_commands( c : &mut Criterion ) diff --git a/module/move/wca/src/ca/verifier/verifier.rs b/module/move/wca/src/ca/verifier/verifier.rs index bbcaed149c..704bb31fe4 100644 --- a/module/move/wca/src/ca/verifier/verifier.rs +++ b/module/move/wca/src/ca/verifier/verifier.rs @@ -139,7 +139,7 @@ mod private raw_properties.iter() .filter( | ( k, _ ) | { - !( properties.contains_key( *k ) || properties_aliases.get( *k ).map_or( false, | key | properties.contains_key( key ) ) ) + !( properties.contains_key( *k ) || properties_aliases.get( *k ).is_some_and( | key | properties.contains_key( key ) ) ) }) .count() } From b2764fae2eb3c1c1de4ceb75adc4426f058fe373 Mon Sep 17 00:00:00 2001 From: SupperZum Date: Mon, 17 Mar 2025 14:44:37 +0200 Subject: [PATCH 2/4] fix new clippy --- module/core/clone_dyn_types/src/lib.rs | 2 +- module/core/former_meta/src/derive_former.rs | 28 ++++----- .../former_meta/src/derive_former/field.rs | 62 +++++++++---------- .../src/derive_former/field_attrs.rs | 20 +++--- .../src/derive_former/struct_attrs.rs | 4 +- module/move/wca/benches/bench.rs | 2 +- module/move/wca/src/ca/verifier/verifier.rs | 3 +- 7 files changed, 59 insertions(+), 62 deletions(-) diff --git a/module/core/clone_dyn_types/src/lib.rs b/module/core/clone_dyn_types/src/lib.rs index 68fdff07d4..48e82f2a3b 100644 --- a/module/core/clone_dyn_types/src/lib.rs +++ b/module/core/clone_dyn_types/src/lib.rs @@ -190,7 +190,7 @@ mod private unsafe { let mut ptr = ref_dyn as *const T; - let data_ptr = &mut ptr as *mut *const T as *mut *mut (); + let data_ptr = &raw mut ptr as *mut *mut (); // fix clippy *data_ptr = < T as CloneDyn >::__clone_dyn( ref_dyn, DontCallMe ); Box::from_raw( ptr as *mut T ) } diff --git a/module/core/former_meta/src/derive_former.rs b/module/core/former_meta/src/derive_former.rs index e8a166e3d6..61549a8fe9 100644 --- a/module/core/former_meta/src/derive_former.rs +++ b/module/core/former_meta/src/derive_former.rs @@ -1,6 +1,6 @@ #[ allow( clippy::wildcard_imports ) ] use super::*; -use iter_tools::{ Itertools }; +use iter_tools::Itertools; use macro_tools::{ attr, diag, generic_params, generic_args, typ, derive, Result }; use proc_macro2::TokenStream; @@ -77,7 +77,7 @@ pub fn mutator { let debug = format! ( - r#" + r" = Example of custom mutator impl< {} > former::FormerMutator @@ -91,7 +91,7 @@ where {{ }} }} - "#, + ", format!( "{}", qt!{ #former_definition_types_generics_impl } ), format!( "{}", qt!{ #former_definition_types_generics_ty } ), format!( "{}", qt!{ #former_definition_types_generics_where } ), @@ -99,8 +99,8 @@ where // println!( "{debug}" ); let about = format! ( -r#"derive : Former -item : {item}"#, +r"derive : Former +item : {item}", ); diag::report_print( about, original_input, debug ); }; @@ -116,18 +116,18 @@ fn doc_generate( item : &syn::Ident ) -> ( String, String ) let doc_former_mod = format! ( -r#" Implementation of former for [{item}]. -"# +r" Implementation of former for [{item}]. +" ); let doc_former_struct = format! ( -r#" +r" Structure to form [{item}]. Represents a forming entity designed to construct objects through a builder pattern. This structure holds temporary storage and context during the formation process and utilizes a defined end strategy to finalize the object creation. -"# +" ); ( doc_former_mod, doc_former_struct ) @@ -144,11 +144,7 @@ pub fn former( input : proc_macro::TokenStream ) -> Result< TokenStream > use macro_tools::IntoGenericArgs; let original_input = input.clone(); - let ast = match syn::parse::< syn::DeriveInput >( input ) - { - Ok( syntax_tree ) => syntax_tree, - Err( err ) => return Err( err ), - }; + let ast = syn::parse::< syn::DeriveInput >( input )?; let has_debug = attr::has_debug( ast.attrs.iter() )?; let struct_attrs = ItemAttributes::from_attrs( ast.attrs.iter() )?; @@ -165,12 +161,12 @@ pub fn former( input : proc_macro::TokenStream ) -> Result< TokenStream > let as_subformer_end_doc = format! ( - r#" + r" Represents an end condition for former of [`${item}`], tying the lifecycle of forming processes to a broader context. This trait is intended for use with subformer alias, ensuring that end conditions are met according to the specific needs of the broader forming context. It mandates the implementation of `former::FormingEnd`. - "# + " ); /* parameters for structure */ diff --git a/module/core/former_meta/src/derive_former/field.rs b/module/core/former_meta/src/derive_former/field.rs index c5b398f7cf..34a80bc769 100644 --- a/module/core/former_meta/src/derive_former/field.rs +++ b/module/core/former_meta/src/derive_former/field.rs @@ -1,6 +1,6 @@ #[ allow( clippy::wildcard_imports ) ] use super::*; -use macro_tools::{ container_kind }; +use macro_tools::container_kind; /// /// Definition of a field. @@ -455,7 +455,7 @@ impl< 'a > FormerField< 'a > { let debug = format! ( - r#" + r" impl< Definition > {former}< Definition > where Definition : former::FormerDefinition< Storage = {former_storage} >, @@ -470,14 +470,14 @@ where self }} }} - "#, + ", format!( "{}", qt!{ #typ } ), ); let about = format! ( -r#"derive : Former +r"derive : Former item : {item} -field : {field_ident}"#, +field : {field_ident}", ); diag::report_print( about, original_input, debug ); } @@ -693,7 +693,7 @@ field : {field_ident}"#, { let debug = format! ( - r#" + r" /// The collection setter provides a collection setter that returns a CollectionFormer tailored for managing a collection of child entities. It employs a generic collection definition to facilitate operations on the entire collection, such as adding or updating elements. impl< Definition, > {former}< Definition, > @@ -713,14 +713,14 @@ where }} }} - "#, + ", format!( "{}", qt!{ #( #params, )* } ), ); let about = format! ( -r#"derive : Former +r"derive : Former item : {item} -field : {field_ident}"#, +field : {field_ident}", ); diag::report_print( about, original_input, debug ); } @@ -736,13 +736,13 @@ field : {field_ident}"#, let subform_collection_end_doc = format! ( - r#" + r" A callback structure to manage the final stage of forming a `{0}` for the `{item}` collection. This callback is used to integrate the contents of a temporary `{0}` back into the original `{item}` former after the subforming process is completed. It replaces the existing content of the `{field_ident}` field in `{item}` with the new content generated during the subforming process. - "#, + ", format!( "{}", qt!{ #field_typ } ), ); @@ -891,7 +891,7 @@ with the new content generated during the subforming process. let doc = format! ( - r#" + r" Initiates the addition of {field_ident} to the `{item}` entity using a dedicated subformer. @@ -905,7 +905,7 @@ parent's structure once formed. Returns an instance of `Former2`, a subformer ready to begin the formation process for `{0}` entities, allowing for dynamic and flexible construction of the `{item}` entity's {field_ident}. - "#, + ", format!( "{}", qt!{ #field_typ } ), ); @@ -946,7 +946,7 @@ allowing for dynamic and flexible construction of the `{item}` entity's {field_i let doc = format! ( - r#" + r" Provides a user-friendly interface to add an instancce of {field_ident} to the {item}. # Returns @@ -954,7 +954,7 @@ Provides a user-friendly interface to add an instancce of {field_ident} to the { Returns an instance of `Former2`, a subformer ready to begin the formation process for `{0}` entities, allowing for dynamic and flexible construction of the `{item}` entity's {field_ident}. - "#, + ", format!( "{}", qt!{ #field_typ } ), ); @@ -998,7 +998,7 @@ allowing for dynamic and flexible construction of the `{item}` entity's {field_i { let debug = format! ( - r#" + r" /// Initializes and configures a subformer for adding named child entities. This method leverages an internal function /// to create and return a configured subformer instance. It allows for the dynamic addition of children with specific names, /// integrating them into the formation process of the parent entity. @@ -1016,21 +1016,21 @@ where // Replace {0} with name of type of entry value. }} - "#, + ", format!( "{}", qt!{ #entry_typ } ), ); let about = format! ( -r#"derive : Former +r"derive : Former item : {item} -field : {field_ident}"#, +field : {field_ident}", ); diag::report_print( about, original_input, debug ); } let doc = format! ( - r#" + r" Implements the `FormingEnd` trait for `{subform_entry_end}` to handle the final stage of the forming process for a `{item}` collection that contains `{0}` elements. @@ -1058,7 +1058,7 @@ preformed elements to this storage. Returns the updated `{former}` instance with newly added {field_ident}, completing the formation process of the `{item}`. - "#, + ", format!( "{}", qt!{ #field_typ } ), ); @@ -1179,7 +1179,7 @@ formation process of the `{item}`. let doc = format! ( - r#" + r" Initiates the scalar subformer for a `{0}` entity within a `{item}`. @@ -1203,7 +1203,7 @@ is properly initialized with all necessary configurations, including the default This function is typically called internally by a more user-friendly method that abstracts away the complex generics, providing a cleaner interface for initiating subform operations on scalar fields. - "#, + ", format!( "{}", qt!{ #field_typ } ), ); @@ -1267,7 +1267,7 @@ generics, providing a cleaner interface for initiating subform operations on sca let doc = format! ( - r#" + r" Provides a user-friendly interface to begin subforming a scalar `{0}` field within a `{item}`. This method abstracts the underlying complex generics involved in setting up the former, simplifying the @@ -1277,7 +1277,7 @@ This method utilizes the more generic `{subform_scalar}` method to set up and re providing a straightforward and type-safe interface for client code. It encapsulates details about the specific former and end action types, ensuring a seamless developer experience when forming parts of a `{item}`. - "#, + ", format!( "{}", qt!{ #field_typ } ), ); @@ -1320,7 +1320,7 @@ former and end action types, ensuring a seamless developer experience when formi { let debug = format! ( - r#" + r" /// Extends `{former}` to include a method that initializes and configures a subformer for the '{field_ident}' field. /// This function demonstrates the dynamic addition of a named {field_ident}, leveraging a subformer to specify detailed properties. @@ -1334,21 +1334,21 @@ where self._{field_ident}_subform_scalar::< {0}Former< _ >, _, >().name( name ) }} }} - "#, + ", format!( "{}", qt!{ #field_typ } ), ); let about = format! ( -r#"derive : Former +r"derive : Former item : {item} -field : {field_ident}"#, +field : {field_ident}", ); diag::report_print( about, original_input, debug ); } let doc = format! ( - r#" + r" Represents the endpoint for the forming process of a scalar field managed by a subformer within a `{item}` entity. @@ -1366,7 +1366,7 @@ Essentially, this end action integrates the individually formed scalar value bac - `super_former`: An optional context of the `{former}`, which will receive the value. The function ensures that this context is not `None` and inserts the formed value into the designated field within `{item}`'s storage. - "#, + ", format!( "{}", qt!{ #field_typ } ), ); diff --git a/module/core/former_meta/src/derive_former/field_attrs.rs b/module/core/former_meta/src/derive_former/field_attrs.rs index 7f97619d9a..a2971f46a5 100644 --- a/module/core/former_meta/src/derive_former/field_attrs.rs +++ b/module/core/former_meta/src/derive_former/field_attrs.rs @@ -206,10 +206,10 @@ impl syn::parse::Parse for AttributeConfig syn_err! ( ident, - r#"Expects an attribute of format '#[ former( default = 13 ) ]' + r"Expects an attribute of format '#[ former( default = 13 ) ]' {known} But got: '{}' -"#, +", qt!{ #ident } ) }; @@ -368,10 +368,10 @@ impl syn::parse::Parse for AttributeScalarSetter syn_err! ( ident, - r#"Expects an attribute of format '#[ scalar( name = myName, setter = true ) ]' + r"Expects an attribute of format '#[ scalar( name = myName, setter = true ) ]' {known} But got: '{}' -"#, +", qt!{ #ident } ) }; @@ -544,10 +544,10 @@ impl syn::parse::Parse for AttributeSubformScalarSetter syn_err! ( ident, - r#"Expects an attribute of format '#[ subform_scalar( name = myName, setter = true ) ]' + r"Expects an attribute of format '#[ subform_scalar( name = myName, setter = true ) ]' {known} But got: '{}' -"#, +", qt!{ #ident } ) }; @@ -735,10 +735,10 @@ impl syn::parse::Parse for AttributeSubformCollectionSetter syn_err! ( ident, - r#"Expects an attribute of format '#[ subform_collection( name = myName, setter = true, debug, definition = MyDefinition ) ]' + r"Expects an attribute of format '#[ subform_collection( name = myName, setter = true, debug, definition = MyDefinition ) ]' {known} But got: '{}' -"#, +", qt!{ #ident } ) }; @@ -919,10 +919,10 @@ impl syn::parse::Parse for AttributeSubformEntrySetter syn_err! ( ident, - r#"Expects an attribute of format '#[ subform( name = myName, setter = true ) ]' + r"Expects an attribute of format '#[ subform( name = myName, setter = true ) ]' {known} But got: '{}' -"#, +", qt!{ #ident } ) }; diff --git a/module/core/former_meta/src/derive_former/struct_attrs.rs b/module/core/former_meta/src/derive_former/struct_attrs.rs index 3d01240657..4647f14c6d 100644 --- a/module/core/former_meta/src/derive_former/struct_attrs.rs +++ b/module/core/former_meta/src/derive_former/struct_attrs.rs @@ -347,10 +347,10 @@ impl syn::parse::Parse for AttributeMutator syn_err! ( ident, - r#"Expects an attribute of format '#[ mutator( custom ) ]' + r"Expects an attribute of format '#[ mutator( custom ) ]' {known} But got: '{}' -"#, +", qt!{ #ident } ) }; diff --git a/module/move/wca/benches/bench.rs b/module/move/wca/benches/bench.rs index 45469b2476..8b05ccf91d 100644 --- a/module/move/wca/benches/bench.rs +++ b/module/move/wca/benches/bench.rs @@ -77,7 +77,7 @@ fn initialize_commands_with_properties( count : usize ) -> CommandsAggregator fn run_commands< S : AsRef< str > >( ca : CommandsAggregator, command : S ) { - ca.perform( command.as_ref() ).unwrap() + ca.perform( command.as_ref() ).unwrap(); } fn benchmark_initialize_thousand_commands( c : &mut Criterion ) diff --git a/module/move/wca/src/ca/verifier/verifier.rs b/module/move/wca/src/ca/verifier/verifier.rs index bbcaed149c..14cd9d79c4 100644 --- a/module/move/wca/src/ca/verifier/verifier.rs +++ b/module/move/wca/src/ca/verifier/verifier.rs @@ -139,7 +139,8 @@ mod private raw_properties.iter() .filter( | ( k, _ ) | { - !( properties.contains_key( *k ) || properties_aliases.get( *k ).map_or( false, | key | properties.contains_key( key ) ) ) + // fix clippy + !( properties.contains_key( *k ) || properties_aliases.get( *k ).is_some_and( | key | properties.contains_key( key ) ) ) }) .count() } From 070f02af7f3f3288b97faced7937e1628a229ff3 Mon Sep 17 00:00:00 2001 From: SupperZum Date: Mon, 17 Mar 2025 15:01:02 +0200 Subject: [PATCH 3/4] fix doc --- module/core/data_type/Readme.md | 2 +- module/core/former_meta/src/lib.rs | 2 +- module/move/willbe/src/entity/code.rs | 1 - module/move/willbe/tests/inc/package.rs | 8 ++++---- module/move/willbe/tests/tests.rs | 3 +-- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/module/core/data_type/Readme.md b/module/core/data_type/Readme.md index ddadd7fb57..f0f82dd4a8 100644 --- a/module/core/data_type/Readme.md +++ b/module/core/data_type/Readme.md @@ -30,7 +30,7 @@ Macro [types](https://docs.rs/type_constructor/latest/type_constructor/types/mac ### Basic Use Case :: make - variadic constructor -Implement traits [`From_0`], [From1] up to `MakeN` to provide the interface to construct your structure with a different set of arguments. +Implement traits \[`From_0`\], \[`From1`\] up to `MakeN` to provide the interface to construct your structure with a different set of arguments. In this example structure, Struct1 could be constructed either without arguments, with a single argument, or with two arguments. - Constructor without arguments fills fields with zero. - Constructor with a single argument sets both fields to the value of the argument. diff --git a/module/core/former_meta/src/lib.rs b/module/core/former_meta/src/lib.rs index 0f58850305..03ac3ef6bf 100644 --- a/module/core/former_meta/src/lib.rs +++ b/module/core/former_meta/src/lib.rs @@ -268,7 +268,7 @@ pub fn component_assign( input : proc_macro::TokenStream ) -> proc_macro::TokenS /// Derives the `ComponentsAssign` trait for a struct, enabling `components_assign` which set all fields at once. /// /// This will work only if every field can be acquired from the passed value. -/// In other words, the type passed as an argument to `components_assign` must implement Into for each field type. +/// In other words, the type passed as an argument to `components_assign` must implement `Into` for each field type. /// /// # Attributes /// diff --git a/module/move/willbe/src/entity/code.rs b/module/move/willbe/src/entity/code.rs index 0faf0cdf27..6ca091b1f4 100644 --- a/module/move/willbe/src/entity/code.rs +++ b/module/move/willbe/src/entity/code.rs @@ -15,7 +15,6 @@ mod private /// typically as a string. This can be useful for generating code from various data structures /// or objects. /// - /// ``` pub trait AsCode { /// Converts the object to its code representation. diff --git a/module/move/willbe/tests/inc/package.rs b/module/move/willbe/tests/inc/package.rs index bc83b38d89..6c820d100e 100644 --- a/module/move/willbe/tests/inc/package.rs +++ b/module/move/willbe/tests/inc/package.rs @@ -58,14 +58,14 @@ impl TestPackage self.dependencies.push( Dependency::Normal { name: name.into(), path: None, is_macro: false } ); self } - - pub fn macro_dependency( mut self, name: impl Into< String > ) -> Self + // never used + pub fn _macro_dependency( mut self, name: impl Into< String > ) -> Self { self.dependencies.push( Dependency::Normal { name: name.into(), path: None, is_macro: true } ); self } - - pub fn dev_dependency( mut self, name: impl Into< String > ) -> Self + // never used + pub fn _dev_dependency( mut self, name: impl Into< String > ) -> Self { self.dependencies.push( Dependency::Dev { name: name.into(), path: None, is_macro: false } ); self diff --git a/module/move/willbe/tests/tests.rs b/module/move/willbe/tests/tests.rs index 87a862274b..3e8c5b7621 100644 --- a/module/move/willbe/tests/tests.rs +++ b/module/move/willbe/tests/tests.rs @@ -1,11 +1,10 @@ - include!( "../../../../module/step/meta/src/module/terminal.rs" ); #[ allow( unused_imports ) ] use willbe as the_module; #[ allow( unused_imports ) ] use test_tools::exposed::*; - +/// asset path pub const ASSET_PATH : &str = "tests/asset"; mod inc; From 2418f812c72e91add7041669898c4adc6f769530 Mon Sep 17 00:00:00 2001 From: SupperZum Date: Wed, 2 Apr 2025 17:22:26 +0300 Subject: [PATCH 4/4] fix all issues --- module/core/data_type/src/lib.rs | 1 - .../core/derive_tools_meta/src/derive/from.rs | 8 ++-- .../src/derive/from/field_attributes.rs | 5 +-- .../src/derive/from/item_attributes.rs | 5 +-- module/core/derive_tools_meta/src/lib.rs | 11 ----- .../src/component/component_from.rs | 1 - .../src/component/components_assign.rs | 3 +- .../src/component/from_components.rs | 3 -- module/core/former_meta/src/lib.rs | 4 -- module/core/iter_tools/src/iter.rs | 6 +-- module/core/process_tools/src/environment.rs | 1 - module/core/pth/src/path.rs | 26 +++++------- module/move/wca/src/ca/verifier/verifier.rs | 19 ++++----- module/move/willbe/src/action/features.rs | 20 ++++------ module/move/willbe/src/action/main_header.rs | 4 +- .../src/action/readme_health_table_renew.rs | 17 ++++---- .../action/readme_modules_headers_renew.rs | 12 +++--- .../move/willbe/src/command/deploy_renew.rs | 1 - module/move/willbe/src/command/features.rs | 1 - module/move/willbe/src/command/list.rs | 1 - module/move/willbe/src/command/mod.rs | 1 - module/move/willbe/src/command/publish.rs | 1 - .../move/willbe/src/command/publish_diff.rs | 1 - .../willbe/src/command/workspace_renew.rs | 1 - module/move/willbe/src/entity/dependency.rs | 12 +++--- module/move/willbe/src/entity/package.rs | 21 +++++----- .../willbe/src/entity/package_md_extension.rs | 4 +- module/move/willbe/src/entity/packages.rs | 6 +-- module/move/willbe/src/entity/progress_bar.rs | 2 +- module/move/willbe/src/entity/publish.rs | 2 +- module/move/willbe/src/entity/test.rs | 6 +-- .../willbe/src/entity/workspace_package.rs | 10 ++--- module/move/willbe/src/tool/files.rs | 1 - module/move/willbe/src/tool/git.rs | 4 -- module/move/willbe/src/tool/graph.rs | 1 - .../tests/inc/action_tests/cicd_renew.rs | 2 +- .../tests/inc/action_tests/list/format.rs | 36 ++++++++--------- .../action_tests/readme_health_table_renew.rs | 24 +++++------ .../readme_modules_headers_renew.rs | 2 +- .../willbe/tests/inc/action_tests/test.rs | 34 ++++++++-------- .../tests/inc/action_tests/workspace_renew.rs | 10 ++--- .../willbe/tests/inc/command/tests_run.rs | 8 ++-- .../move/willbe/tests/inc/entity/features.rs | 2 +- .../move/willbe/tests/inc/entity/version.rs | 6 +-- module/move/willbe/tests/inc/helper.rs | 8 ++-- module/move/willbe/tests/inc/package.rs | 8 ++-- .../move/willbe/tests/inc/tool/graph_test.rs | 12 +++--- .../move/willbe/tests/inc/tool/query_test.rs | 40 +++++++++---------- 48 files changed, 178 insertions(+), 236 deletions(-) diff --git a/module/core/data_type/src/lib.rs b/module/core/data_type/src/lib.rs index b645eb9a71..c365abca4b 100644 --- a/module/core/data_type/src/lib.rs +++ b/module/core/data_type/src/lib.rs @@ -11,7 +11,6 @@ pub mod dt; /// Namespace with dependencies. - #[ cfg( feature = "enabled" ) ] pub mod dependency { diff --git a/module/core/derive_tools_meta/src/derive/from.rs b/module/core/derive_tools_meta/src/derive/from.rs index 59a7462435..099b3f0770 100644 --- a/module/core/derive_tools_meta/src/derive/from.rs +++ b/module/core/derive_tools_meta/src/derive/from.rs @@ -498,7 +498,7 @@ fn variant_generate { let debug = format! ( - r#" + r" #[ automatically_derived ] impl< {0} > From< {args} > for {item_name}< {1} > where @@ -510,16 +510,16 @@ where Self::{variant_name}( {use_src} ) }} }} - "#, + ", format!( "{}", qt!{ #generics_impl } ), format!( "{}", qt!{ #generics_ty } ), format!( "{}", qt!{ #generics_where } ), ); let about = format! ( -r#"derive : From +r"derive : From item : {item_name} -field : {variant_name}"#, +field : {variant_name}", ); diag::report_print( about, original_input, debug ); } diff --git a/module/core/derive_tools_meta/src/derive/from/field_attributes.rs b/module/core/derive_tools_meta/src/derive/from/field_attributes.rs index 53d1c60393..bd528d3c28 100644 --- a/module/core/derive_tools_meta/src/derive/from/field_attributes.rs +++ b/module/core/derive_tools_meta/src/derive/from/field_attributes.rs @@ -14,7 +14,6 @@ use former_types::Assign; /// /// Attributes of a field / variant /// - /// Represents the attributes of a struct. Aggregates all its attributes. #[ derive( Debug, Default ) ] pub struct FieldAttributes @@ -181,10 +180,10 @@ impl syn::parse::Parse for FieldAttributeConfig syn_err! ( ident, - r#"Expects an attribute of format '#[ from( on ) ]' + r"Expects an attribute of format '#[ from( on ) ]' {known} But got: '{}' -"#, +", qt!{ #ident } ) }; diff --git a/module/core/derive_tools_meta/src/derive/from/item_attributes.rs b/module/core/derive_tools_meta/src/derive/from/item_attributes.rs index 4c81f3bcf1..132fde24a0 100644 --- a/module/core/derive_tools_meta/src/derive/from/item_attributes.rs +++ b/module/core/derive_tools_meta/src/derive/from/item_attributes.rs @@ -12,7 +12,6 @@ use former_types::Assign; /// /// Attributes of the whole tiem /// - /// Represents the attributes of a struct. Aggregates all its attributes. #[ derive( Debug, Default ) ] pub struct ItemAttributes @@ -165,10 +164,10 @@ impl syn::parse::Parse for ItemAttributeConfig syn_err! ( ident, - r#"Expects an attribute of format '#[ from( off ) ]' + r"Expects an attribute of format '#[ from( off ) ]' {known} But got: '{}' -"#, +", qt!{ #ident } ) }; diff --git a/module/core/derive_tools_meta/src/lib.rs b/module/core/derive_tools_meta/src/lib.rs index 310fb2bf09..c3c6657026 100644 --- a/module/core/derive_tools_meta/src/lib.rs +++ b/module/core/derive_tools_meta/src/lib.rs @@ -79,7 +79,6 @@ mod derive; /// /// The macro facilitates the conversion without additional boilerplate code. /// - #[ cfg( feature = "enabled" ) ] #[ cfg( feature = "derive_from" ) ] #[ proc_macro_derive @@ -134,7 +133,6 @@ pub fn from( input : proc_macro::TokenStream ) -> proc_macro::TokenStream /// /// The macro facilitates the conversion without additional boilerplate code. /// - #[ cfg( feature = "enabled" ) ] #[ cfg( feature = "derive_new" ) ] #[ proc_macro_derive @@ -229,7 +227,6 @@ pub fn new( input : proc_macro::TokenStream ) -> proc_macro::TokenStream /// } /// } /// ``` - #[ cfg( feature = "enabled" ) ] #[ cfg( feature = "derive_inner_from" ) ] #[ proc_macro_derive( InnerFrom, attributes( debug ) ) ] @@ -270,7 +267,6 @@ pub fn inner_from( input : proc_macro::TokenStream ) -> proc_macro::TokenStream /// } /// } /// ``` - #[ cfg( feature = "enabled" ) ] #[ cfg( feature = "derive_deref" ) ] #[ proc_macro_derive( Deref, attributes( debug ) ) ] @@ -330,7 +326,6 @@ pub fn deref( input : proc_macro::TokenStream ) -> proc_macro::TokenStream /// } /// /// ``` - #[ cfg( feature = "enabled" ) ] #[ cfg( feature = "derive_deref_mut" ) ] #[ proc_macro_derive( DerefMut, attributes( debug ) ) ] @@ -369,7 +364,6 @@ pub fn deref_mut( input : proc_macro::TokenStream ) -> proc_macro::TokenStream /// } /// } /// ``` - #[ cfg( feature = "enabled" ) ] #[ cfg( feature = "derive_as_ref" ) ] #[ proc_macro_derive( AsRef, attributes( debug ) ) ] @@ -409,7 +403,6 @@ pub fn as_ref( input : proc_macro::TokenStream ) -> proc_macro::TokenStream /// } /// /// ``` - #[ cfg( feature = "enabled" ) ] #[ cfg( feature = "derive_as_mut" ) ] #[ proc_macro_derive( AsMut, attributes( debug ) ) ] @@ -514,7 +507,6 @@ pub fn as_mut( input : proc_macro::TokenStream ) -> proc_macro::TokenStream /// } /// ``` /// - #[ cfg( feature = "enabled" ) ] #[ cfg( feature = "derive_variadic_from" ) ] #[ proc_macro_derive( VariadicFrom, attributes( debug ) ) ] @@ -619,7 +611,6 @@ pub fn derive_not( input : proc_macro::TokenStream ) -> proc_macro::TokenStream /// /// The macro facilitates the addition of the `PhantomData` field without additional boilerplate code. /// - #[ cfg( feature = "enabled" ) ] #[ cfg ( feature = "derive_phantom" ) ] #[ proc_macro_attribute ] @@ -675,7 +666,6 @@ pub fn phantom( _attr: proc_macro::TokenStream, input : proc_macro::TokenStream /// }; /// ``` /// - #[ cfg( feature = "enabled" ) ] #[ cfg( feature = "derive_index" ) ] #[ proc_macro_derive @@ -745,7 +735,6 @@ pub fn derive_index( input : proc_macro::TokenStream ) -> proc_macro::TokenStrea /// }; /// ``` /// - #[ cfg( feature = "enabled" ) ] #[ cfg( feature = "derive_index_mut" ) ] #[ proc_macro_derive diff --git a/module/core/former_meta/src/component/component_from.rs b/module/core/former_meta/src/component/component_from.rs index c366ef3b1c..9c505429a7 100644 --- a/module/core/former_meta/src/component/component_from.rs +++ b/module/core/former_meta/src/component/component_from.rs @@ -56,7 +56,6 @@ pub fn component_from( input : proc_macro::TokenStream ) -> Result< proc_macro2: /// } /// } /// - fn for_each_field( field : &syn::Field, item_name : &syn::Ident ) -> Result< proc_macro2::TokenStream > { let field_name = field.ident.as_ref() diff --git a/module/core/former_meta/src/component/components_assign.rs b/module/core/former_meta/src/component/components_assign.rs index 3716ef2161..3ad19ae423 100644 --- a/module/core/former_meta/src/component/components_assign.rs +++ b/module/core/former_meta/src/component/components_assign.rs @@ -1,14 +1,13 @@ #[ allow( clippy::wildcard_imports ) ] use super::*; use macro_tools::{ attr, diag, Result, format_ident }; -use iter_tools::{ Itertools }; +use iter_tools::Itertools; /// /// Generate `ComponentsAssign` trait implementation for the type, providing `components_assign` function /// /// Output example can be found in in the root of the module /// - pub fn components_assign( input : proc_macro::TokenStream ) -> Result< proc_macro2::TokenStream > { use convert_case::{ Case, Casing }; diff --git a/module/core/former_meta/src/component/from_components.rs b/module/core/former_meta/src/component/from_components.rs index c496ea15d9..46dcdbd3ad 100644 --- a/module/core/former_meta/src/component/from_components.rs +++ b/module/core/former_meta/src/component/from_components.rs @@ -32,7 +32,6 @@ use macro_tools::{ attr, diag, item_struct, Result }; /// } /// ``` /// - #[ inline ] pub fn from_components( input : proc_macro::TokenStream ) -> Result< proc_macro2::TokenStream > { @@ -97,7 +96,6 @@ pub fn from_components( input : proc_macro::TokenStream ) -> Result< proc_macro2 /// ``` /// /// These trait bounds are then used in the `From` implementation to ensure type compatibility. - #[ inline ] // fn trait_bounds( field_types : &[ &syn::Type ] ) -> Vec< proc_macro2::TokenStream > fn trait_bounds< 'a >( field_types : impl macro_tools::IterTrait< 'a, &'a syn::Type > ) -> Vec< proc_macro2::TokenStream > @@ -125,7 +123,6 @@ fn trait_bounds< 'a >( field_types : impl macro_tools::IterTrait< 'a, &'a syn::T /// let field2 = Into::< String >::into( src.clone() ); /// ``` /// - #[ inline ] fn field_assign< 'a >( fields : impl Iterator< Item = &'a syn::Field > ) -> Vec< proc_macro2::TokenStream > { diff --git a/module/core/former_meta/src/lib.rs b/module/core/former_meta/src/lib.rs index 03ac3ef6bf..a36c81e15e 100644 --- a/module/core/former_meta/src/lib.rs +++ b/module/core/former_meta/src/lib.rs @@ -157,7 +157,6 @@ pub fn former( input : proc_macro::TokenStream ) -> proc_macro::TokenStream /// # } /// ``` /// - #[ cfg( feature = "enabled" ) ] #[ cfg( feature = "derive_component_from" ) ] #[ proc_macro_derive( ComponentFrom, attributes( debug ) ) ] @@ -250,7 +249,6 @@ pub fn component_from( input : proc_macro::TokenStream ) -> proc_macro::TokenStr /// ``` /// This allows any type that can be converted into an `i32` or `String` to be set as /// the value of the `age` or `name` fields of `Person` instances, respectively. - #[ cfg( feature = "enabled" ) ] #[ cfg( feature = "derive_component_assign" ) ] #[ proc_macro_derive( Assign, attributes( debug ) ) ] @@ -503,7 +501,6 @@ pub fn component_assign( input : proc_macro::TokenStream ) -> proc_macro::TokenS /// take_smaller_opts( &options2 ); /// ``` /// - #[ cfg( feature = "enabled" ) ] #[ cfg( all( feature = "derive_component_assign", feature = "derive_components_assign" ) ) ] #[ proc_macro_derive( ComponentsAssign, attributes( debug ) ) ] @@ -604,7 +601,6 @@ pub fn components_assign( input : proc_macro::TokenStream ) -> proc_macro::Token /// automatically generating the necessary `From< &Options1 >` implementation for `Options2`, facilitating /// an easy conversion between these types based on their compatible fields. /// - #[ cfg( feature = "enabled" ) ] #[ cfg( feature = "derive_from_components" ) ] #[ proc_macro_derive( FromComponents, attributes( debug ) ) ] diff --git a/module/core/iter_tools/src/iter.rs b/module/core/iter_tools/src/iter.rs index 4c6a69b7a1..aa5d68128c 100644 --- a/module/core/iter_tools/src/iter.rs +++ b/module/core/iter_tools/src/iter.rs @@ -163,7 +163,6 @@ mod private pub type BoxedIter< 'a, T > = Box< dyn _IterTrait< 'a, T > + 'a >; /// Extension of iterator. - // zzz : review #[ cfg( feature = "iter_ext" ) ] #[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ] @@ -297,10 +296,7 @@ pub mod exposed #[ doc( inline ) ] #[ cfg( feature = "iter_trait" ) ] #[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ] - pub use private:: - { - BoxedIter, - }; + pub use private::BoxedIter; diff --git a/module/core/process_tools/src/environment.rs b/module/core/process_tools/src/environment.rs index 485b2b6092..77d7ad10ad 100644 --- a/module/core/process_tools/src/environment.rs +++ b/module/core/process_tools/src/environment.rs @@ -27,7 +27,6 @@ mod private /// use process_tools::environment; /// assert_eq!( environment::is_cicd(), true ); /// ``` - #[ cfg( feature = "process_environment_is_cicd" ) ] #[ must_use ] pub fn is_cicd() -> bool diff --git a/module/core/pth/src/path.rs b/module/core/pth/src/path.rs index 2cfa572556..0bfba03a0c 100644 --- a/module/core/pth/src/path.rs +++ b/module/core/pth/src/path.rs @@ -1,5 +1,4 @@ /// Define a private namespace for all its items. - #[ allow( clippy::std_instead_of_alloc, clippy::std_instead_of_core ) ] mod private { @@ -37,7 +36,6 @@ mod private /// assert_eq!( path::is_glob( "file[0-9].txt" ), true ); // Unescaped brackets indicate a glob pattern /// assert_eq!( path::is_glob( "file\\[0-9].txt" ), false ); // Escaped brackets, not a glob pattern /// ``` - // qqq : xxx : should probably be Path #[ must_use ] pub fn is_glob( path : &str ) -> bool @@ -132,7 +130,6 @@ mod private /// /// A `PathBuf` containing the normalized path. /// - pub fn normalize< P : AsRef< std::path::Path > >( path : P ) -> std::path::PathBuf { use std::path::{ Component, PathBuf }; @@ -192,7 +189,8 @@ mod private // Convert back to a PathBuf using "/" as the separator for consistency #[ cfg( target_os = "windows" ) ] - let normalized = PathBuf::from( normalized.to_string_lossy().replace( "\\", "/" ) ); + let normalized = PathBuf::from( normalized.to_string_lossy().replace( '\\', "/" ) ); + // fix clippy normalized } @@ -224,7 +222,7 @@ mod private #[ cfg( target_os = "windows" ) ] let path = { - const VERBATIM_PREFIX : &str = r#"\\?\"#; + const VERBATIM_PREFIX : &str = r"\\?\"; // is necessary because of the normalization step that replaces the backslash with a slash. const VERBATIM_PREFIX_MIRRORS_EDGE : &str = "//?/"; let p = path.display().to_string(); @@ -234,7 +232,8 @@ mod private } else { - path.into() + // fix clippy + path } }; @@ -270,7 +269,6 @@ mod private /// ``` /// # Errors /// qqq: doc - #[ cfg( feature = "path_unique_folder_name" ) ] pub fn unique_folder_name() -> std::result::Result< std::string::String, std::time::SystemTimeError > { @@ -283,7 +281,8 @@ mod private // Thread-local static variable for a counter std::thread_local! { - #[ allow( clippy::thread_local_initializer_can_be_made_const ) ] + // fix clippy + #[ allow( clippy::missing_const_for_thread_local ) ] static COUNTER : core::cell::Cell< usize > = core::cell::Cell::new( 0 ); } @@ -482,7 +481,6 @@ mod private /// assert_eq!( extensions, expected ); /// ``` /// - // qqq : xxx : should return iterator pub fn exts( path : impl AsRef< std::path::Path > ) -> std::vec::Vec< std::string::String > { @@ -561,11 +559,8 @@ mod private let path_buf = Path::new( path.as_ref() ); - let parent = match path_buf.parent() - { - Some( parent ) => parent, - None => return None, - }; + // fix clippy + let parent = path_buf.parent()?; let file_stem = match path_buf.file_stem() { Some( name ) => @@ -668,7 +663,6 @@ mod private /// assert_eq!( common_path, Some( "/a/b/".to_string() ) ); /// ``` /// - // xxx : qqq : should probably be PathBuf? pub fn path_common< 'a, I >( paths : I ) -> Option< std::string::String > where @@ -759,7 +753,6 @@ mod private /// /// * `path` - A mutable reference to a string representing the path to be cleaned. /// - // xxx : qqq : should probably be Path? fn path_remove_dots( path : &mut std::string::String ) { @@ -784,7 +777,6 @@ mod private /// /// * `path` - A mutable reference to a string representing the path to be cleaned. /// - // xxx : qqq : should probably be Path? fn path_remove_double_dots( path : &mut std::string::String ) { diff --git a/module/move/wca/src/ca/verifier/verifier.rs b/module/move/wca/src/ca/verifier/verifier.rs index 14cd9d79c4..5996751778 100644 --- a/module/move/wca/src/ca/verifier/verifier.rs +++ b/module/move/wca/src/ca/verifier/verifier.rs @@ -267,19 +267,16 @@ mod private props : Props( HashMap::new() ), }); } + // fix clippy let command = dictionary.command( &raw_command.name ) - .ok_or_else::< VerificationError, _ > - ( - || - { - #[ cfg( feature = "on_unknown_suggest" ) ] - if let Some( phrase ) = Self::suggest_command( dictionary, &raw_command.name ) - { - return VerificationError::CommandNotFound { name_suggestion: Some( phrase.to_string() ), command_info: None }; - } - VerificationError::CommandNotFound { name_suggestion: None, command_info: None } + .ok_or( + { + #[ cfg( feature = "on_unknown_suggest" ) ] + if let Some( phrase ) = Self::suggest_command( dictionary, &raw_command.name ) { + return VerificationError::CommandNotFound { name_suggestion: Some( phrase.to_string() ), command_info: None }; } - )?; + VerificationError::CommandNotFound { name_suggestion: None, command_info: None } + })?; let Some( cmd ) = Self::check_command( command, &raw_command ) else { diff --git a/module/move/willbe/src/action/features.rs b/module/move/willbe/src/action/features.rs index 5bccd0a266..cc52f93ff1 100644 --- a/module/move/willbe/src/action/features.rs +++ b/module/move/willbe/src/action/features.rs @@ -4,10 +4,7 @@ mod private #[ allow( clippy::wildcard_imports ) ] use crate::*; - use std:: - { - fmt - }; + use std::fmt; use collection::{ BTreeMap, HashMap }; // // use path::AbsolutePath; @@ -51,15 +48,14 @@ mod private features.iter().try_for_each ( | ( feature, dependencies ) | { - let feature = match self.with_features_deps + // fix clippy + let feature = if self.with_features_deps { - false => format!( "\t{feature}" ), - true => - { - let deps = dependencies.join( ", " ); - format!( "\t{feature}: [{deps}]" ) - } - }; + let deps = dependencies.join( ", " ); + format!( "\t{feature}: [{deps}]" ) + } + else + { format!( "\t{feature}" ) }; writeln!( f, "{feature}" ) } ) diff --git a/module/move/willbe/src/action/main_header.rs b/module/move/willbe/src/action/main_header.rs index 0989fba06b..a84ee09d1b 100644 --- a/module/move/willbe/src/action/main_header.rs +++ b/module/move/willbe/src/action/main_header.rs @@ -160,9 +160,9 @@ mod private ( format! ( - r#"[![{}](https://img.shields.io/github/actions/workflow/status/{}/standard_rust_scheduled.yml?label={}&logo=github&branch={})](https://github.com/{}/actions/workflows/standard_rust_scheduled.yml){} + r"[![{}](https://img.shields.io/github/actions/workflow/status/{}/standard_rust_scheduled.yml?label={}&logo=github&branch={})](https://github.com/{}/actions/workflows/standard_rust_scheduled.yml){} [![Open in Gitpod](https://raster.shields.io/static/v1?label=try&message=online&color=eee&logo=gitpod&logoColor=eee)](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=sample%2Frust%2F{}_trivial_sample%2Fsrc%2Fmain.rs,RUN_POSTFIX=--example%20{}_trivial_sample/https://github.com/{}) -[![docs.rs](https://raster.shields.io/static/v1?label=docs&message=online&color=eee&logo=docsdotrs&logoColor=eee)](https://docs.rs/{})"#, +[![docs.rs](https://raster.shields.io/static/v1?label=docs&message=online&color=eee&logo=docsdotrs&logoColor=eee)](https://docs.rs/{})", self.workspace_name, url::git_info_extract( &self.repository_url )?, self.workspace_name, diff --git a/module/move/willbe/src/action/readme_health_table_renew.rs b/module/move/willbe/src/action/readme_health_table_renew.rs index e18bc551b5..6931eca75b 100644 --- a/module/move/willbe/src/action/readme_health_table_renew.rs +++ b/module/move/willbe/src/action/readme_health_table_renew.rs @@ -152,21 +152,18 @@ mod private { fn from( value : HashMap< String, query::Value > ) -> Self { + // fix clippy let include_branches = value - .get( "with_branches" ) - .map_or( true, bool::from ); + .get( "with_branches" ).is_none_or(bool::from); let include_stability = value - .get( "with_stability" ) - .map_or( true, bool::from ); + .get( "with_stability" ).is_none_or(bool::from); let include_docs = value - .get( "with_docs" ) - .map_or( true, bool::from ); + .get( "with_docs" ).is_none_or(bool::from); let include = value - .get( "with_gitpod" ) - .map_or( true, bool::from ); + .get( "with_gitpod" ).is_none_or(bool::from); let b_p = value.get( "1" ); let base_path = if let Some( query::Value::String( path ) ) = value.get( "path" ).or( b_p ) @@ -598,9 +595,9 @@ ensure that at least one remotest is present in git. ", let file_name = entry.file_name(); if let Some( file_name_str ) = file_name.to_str() { + // fix clippy if std::path::Path::new( file_name_str ) - .extension() - .map_or( false, | ext | ext.eq_ignore_ascii_case( "rs" ) ) + .extension().is_some_and(| ext | ext.eq_ignore_ascii_case( "rs" )) { return Some( entry.path() ) } diff --git a/module/move/willbe/src/action/readme_modules_headers_renew.rs b/module/move/willbe/src/action/readme_modules_headers_renew.rs index 3f6f4254dc..6996506873 100644 --- a/module/move/willbe/src/action/readme_modules_headers_renew.rs +++ b/module/move/willbe/src/action/readme_modules_headers_renew.rs @@ -136,7 +136,8 @@ mod private fn from_cargo_toml ( package : Package< '_ >, - default_discord_url : &Option< String >, + // fix clippy + default_discord_url : Option< &String >, ) -> Result< Self, ModulesHeadersRenewError > { @@ -150,7 +151,7 @@ mod private let discord_url = package .discord_url()? - .or_else( || default_discord_url.clone() ); + .or_else( || default_discord_url.cloned() ); Ok ( Self @@ -193,8 +194,9 @@ mod private ) .to_string_lossy() .to_string(); + // fix clippy #[ cfg( target_os = "windows" ) ] - let relative_path = relative_path.replace( "\\", "/" ); + let relative_path = relative_path.replace( '\\', "/" ); // aaa : for Petro : use path_toools // aaa : used let p = relative_path.replace( '/',"%2F" ); @@ -297,8 +299,8 @@ mod private .err_with_report( &report )? ) .err_with_report( &report )?; - - let header = ModuleHeader::from_cargo_toml( pakage, &discord_url ) + // fix clippy + let header = ModuleHeader::from_cargo_toml( pakage, discord_url.as_ref() ) .err_with_report( &report )?; let mut file = OpenOptions::new() diff --git a/module/move/willbe/src/command/deploy_renew.rs b/module/move/willbe/src/command/deploy_renew.rs index 36a90cdfe0..1ede46795a 100644 --- a/module/move/willbe/src/command/deploy_renew.rs +++ b/module/move/willbe/src/command/deploy_renew.rs @@ -13,7 +13,6 @@ mod private /// /// # Errors /// qqq: doc - // xxx : qqq : typed error #[ allow( clippy::needless_pass_by_value ) ] pub fn deploy_renew( o : VerifiedCommand ) -> error::untyped::Result< () > diff --git a/module/move/willbe/src/command/features.rs b/module/move/willbe/src/command/features.rs index 9fa2ec7596..ec009e9cfb 100644 --- a/module/move/willbe/src/command/features.rs +++ b/module/move/willbe/src/command/features.rs @@ -16,7 +16,6 @@ mod private /// /// # Errors /// qqq: doc - #[ allow( clippy::needless_pass_by_value ) ] pub fn features( o : VerifiedCommand ) -> error::untyped::Result< () > // qqq : use typed error { diff --git a/module/move/willbe/src/command/list.rs b/module/move/willbe/src/command/list.rs index d7e20e4c73..3e2174d1ab 100644 --- a/module/move/willbe/src/command/list.rs +++ b/module/move/willbe/src/command/list.rs @@ -51,7 +51,6 @@ mod private /// /// # Errors /// qqq: doc - // qqq : typed error pub fn list( o : VerifiedCommand ) -> error::untyped::Result< () > { diff --git a/module/move/willbe/src/command/mod.rs b/module/move/willbe/src/command/mod.rs index 5550a9233b..0d2cbe5ee4 100644 --- a/module/move/willbe/src/command/mod.rs +++ b/module/move/willbe/src/command/mod.rs @@ -8,7 +8,6 @@ mod private /// /// Form CA commands grammar. /// - #[ allow( clippy::too_many_lines ) ] pub fn ca() -> CommandsAggregatorFormer { diff --git a/module/move/willbe/src/command/publish.rs b/module/move/willbe/src/command/publish.rs index 8d823eacc5..17622a61a1 100644 --- a/module/move/willbe/src/command/publish.rs +++ b/module/move/willbe/src/command/publish.rs @@ -32,7 +32,6 @@ mod private /// /// # Errors /// qqq: doc - pub fn publish( o : VerifiedCommand ) -> error::untyped::Result< () > // qqq : use typed error { let args_line = format! diff --git a/module/move/willbe/src/command/publish_diff.rs b/module/move/willbe/src/command/publish_diff.rs index a35b453b2e..945ce9fc10 100644 --- a/module/move/willbe/src/command/publish_diff.rs +++ b/module/move/willbe/src/command/publish_diff.rs @@ -35,7 +35,6 @@ mod private /// /// # Panics /// qqq: doc - pub fn publish_diff( o : VerifiedCommand ) -> error::untyped::Result< () > // qqq : use typed error { let path : PathBuf = o.args.get_owned( 0 ).unwrap_or( std::env::current_dir()? ); diff --git a/module/move/willbe/src/command/workspace_renew.rs b/module/move/willbe/src/command/workspace_renew.rs index 3590c85485..9ea05e64a7 100644 --- a/module/move/willbe/src/command/workspace_renew.rs +++ b/module/move/willbe/src/command/workspace_renew.rs @@ -20,7 +20,6 @@ mod private /// /// # Errors /// qqq: doc - // qqq : typed error pub fn workspace_renew( o : VerifiedCommand ) -> error::untyped::Result< () > // qqq : use typed error { diff --git a/module/move/willbe/src/entity/dependency.rs b/module/move/willbe/src/entity/dependency.rs index 128a946061..50d6c08f8b 100644 --- a/module/move/willbe/src/entity/dependency.rs +++ b/module/move/willbe/src/entity/dependency.rs @@ -20,8 +20,8 @@ mod private { inner : &'a cargo_metadata::Dependency, } - - impl< 'a > DependencyRef< 'a > + // fix clippy + impl DependencyRef< '_ > { /// The file system path for a local path dependency. @@ -172,7 +172,7 @@ mod private /// # Panics /// qqq: doc #[ allow( clippy::needless_pass_by_value, clippy::implicit_hasher ) ] - pub fn _list + pub fn list_rec ( workspace : &Workspace, // aaa : for Bohdan : no mut // aaa : no mut package : &Package< '_ >, @@ -214,7 +214,7 @@ mod private if graph.get( &dep ).is_none() { // unwrap because `recursive` + `with_remote` not yet implemented - _list + list_rec ( workspace, &dep.crate_dir.unwrap().try_into()?, @@ -254,7 +254,7 @@ mod private -> error::untyped::Result< Vec< CrateId > > { let mut graph = collection::HashMap::new(); - let root = _list( workspace, package, &mut graph, opts.clone() )?; + let root = list_rec( workspace, package, &mut graph, opts.clone() )?; let output = match opts.sort { @@ -300,7 +300,7 @@ crate::mod_interface! own use CrateId; own use DependenciesSort; own use DependenciesOptions; - own use _list; + own use list_rec; own use list; } diff --git a/module/move/willbe/src/entity/package.rs b/module/move/willbe/src/entity/package.rs index f1be725d77..b5de716391 100644 --- a/module/move/willbe/src/entity/package.rs +++ b/module/move/willbe/src/entity/package.rs @@ -29,8 +29,9 @@ mod private #[ derive( Debug, Clone ) ] pub enum Package< 'a > { + /// `Cargo.toml` file. - Manifest( Manifest ), + Manifest( Box< Manifest > ), // fix clippy /// Cargo package package. WorkspacePackageRef( WorkspacePackageRef< 'a > ), } @@ -59,7 +60,8 @@ mod private NotAPackage, } - impl< 'a > TryFrom< ManifestFile > for Package< 'a > + // fix clippy + impl TryFrom< ManifestFile > for Package< '_ > { type Error = PackageError; @@ -71,11 +73,11 @@ mod private return Err( PackageError::NotAPackage ); } - Ok( Self::Manifest( package ) ) + Ok( Self::Manifest( Box::new( package ) ) ) // fix clippy } } - impl< 'a > TryFrom< CrateDir > for Package< 'a > + impl TryFrom< CrateDir > for Package< '_ > // fix clippy { type Error = PackageError; @@ -87,11 +89,11 @@ mod private return Err( PackageError::NotAPackage ); } - Ok( Self::Manifest( package ) ) + Ok( Self::Manifest( Box::new( package ) ) ) // fix clippy } } - impl< 'a > TryFrom< Manifest > for Package< 'a > + impl TryFrom< Manifest > for Package< '_ > // fix clippy { type Error = PackageError; @@ -102,7 +104,7 @@ mod private return Err( PackageError::NotAPackage ); } - Ok( Self::Manifest( value ) ) + Ok( Self::Manifest( Box::new( value ) ) ) // fix clippy } } @@ -114,7 +116,7 @@ mod private } } - impl< 'a > Package< 'a > + impl Package< '_ > // fix clippy { /// Path to `Cargo.toml` @@ -193,7 +195,7 @@ mod private { match self { - Package::Manifest( package ) => Ok( package.clone() ), + Package::Manifest( package ) => Ok( *package.clone() ), // fix clippy Package::WorkspacePackageRef( package ) => Manifest::try_from ( package.manifest_file().map_err( | _ | PackageError::LocalPath )? // qqq : use trait @@ -217,7 +219,6 @@ mod private /// Panics if the package is not loaded or local package is not packed. /// # Errors /// qqq: doc - pub fn publish_need( package : &Package< '_ >, path : Option< path::PathBuf > ) -> Result< bool, PackageError > { let name = package.name()?; diff --git a/module/move/willbe/src/entity/package_md_extension.rs b/module/move/willbe/src/entity/package_md_extension.rs index 14ab13f3c5..c7c2ef6b00 100644 --- a/module/move/willbe/src/entity/package_md_extension.rs +++ b/module/move/willbe/src/entity/package_md_extension.rs @@ -28,8 +28,8 @@ mod private /// qqq: doc fn discord_url( &self ) -> Result< Option< String >, package::PackageError >; } - - impl < 'a > package::Package< 'a > + // fix clippy + impl package::Package< '_ > { /// Package name /// # Errors diff --git a/module/move/willbe/src/entity/packages.rs b/module/move/willbe/src/entity/packages.rs index 6f83996f3c..7ca63a0eb0 100644 --- a/module/move/willbe/src/entity/packages.rs +++ b/module/move/willbe/src/entity/packages.rs @@ -44,6 +44,7 @@ mod private } } + /// Provides a means to filter both packages and dependencies of an existing package metadata set. /// /// # Arguments @@ -71,10 +72,7 @@ mod private /// * `dependency_filter`: When specified, it's used with each package and its dependencies to decide /// which dependencies should be included in the return for that package. If not provided, all /// dependencies for a package are included. - - // aaa : for Bohdan : for Petro : bad. don't use PackageMetadata directly, use its abstraction only! - - pub fn filter< 'a > + pub fn filter< 'a > // aaa : for Bohdan : for Petro : bad. don't use PackageMetadata directly, use its abstraction only! ( // packages : &[ WorkspacePackageRef< '_ > ], packages : impl Iterator< Item = WorkspacePackageRef< 'a > >, diff --git a/module/move/willbe/src/entity/progress_bar.rs b/module/move/willbe/src/entity/progress_bar.rs index 5f231ad703..51ad62b22c 100644 --- a/module/move/willbe/src/entity/progress_bar.rs +++ b/module/move/willbe/src/entity/progress_bar.rs @@ -19,7 +19,7 @@ mod private } #[ cfg( feature = "progress_bar" ) ] - impl < 'a > std::fmt::Debug for ProgressBar< 'a > + impl std::fmt::Debug for ProgressBar< '_ > // fix clippy { fn fmt( &self, f : &mut std::fmt::Formatter< '_ > ) -> std::fmt::Result { diff --git a/module/move/willbe/src/entity/publish.rs b/module/move/willbe/src/entity/publish.rs index 47af2f9440..6e1476fa0f 100644 --- a/module/move/willbe/src/entity/publish.rs +++ b/module/move/willbe/src/entity/publish.rs @@ -51,7 +51,7 @@ mod private dry : bool, } - impl< 'a > PublishSinglePackagePlanner< 'a > + impl PublishSinglePackagePlanner< '_ > // fix clippy { fn build( self ) -> PackagePublishInstruction { diff --git a/module/move/willbe/src/entity/test.rs b/module/move/willbe/src/entity/test.rs index 8bf4156ea3..0877c250dd 100644 --- a/module/move/willbe/src/entity/test.rs +++ b/module/move/willbe/src/entity/test.rs @@ -391,7 +391,7 @@ mod private /// # Errors /// qqq: doc #[ allow( clippy::needless_pass_by_value ) ] - pub fn _run< P >( path : P, options : SingleTestOptions ) -> Result< Report, Report > + pub fn run_rec< P >( path : P, options : SingleTestOptions ) -> Result< Report, Report > // xxx where P : AsRef< path::Path > @@ -713,7 +713,7 @@ mod private } let args = args_t.form(); let temp_dir = args.temp_directory_path.clone(); - let cmd_rep = _run( crate_dir, args ); + let cmd_rep = run_rec( crate_dir, args ); r.lock().unwrap().tests.insert( variant.clone(), cmd_rep ); #[ cfg( feature = "progress_bar" ) ] if options.with_progress @@ -812,7 +812,7 @@ crate::mod_interface! own use SingleTestOptions; own use TestVariant; - own use _run; + own use run_rec; own use TestPlan; own use TestOptions; diff --git a/module/move/willbe/src/entity/workspace_package.rs b/module/move/willbe/src/entity/workspace_package.rs index 0cbb271103..de72bb8577 100644 --- a/module/move/willbe/src/entity/workspace_package.rs +++ b/module/move/willbe/src/entity/workspace_package.rs @@ -140,7 +140,7 @@ mod private } } - impl< 'a > Entries for WorkspacePackageRef< 'a > + impl Entries for WorkspacePackageRef< '_ > // fix clippy { fn entries( &self ) -> impl IterTrait< '_, SourceFile > { @@ -154,7 +154,7 @@ mod private } } - impl< 'a > Sources for WorkspacePackageRef< 'a > + impl Sources for WorkspacePackageRef< '_ > // fix clippy { fn sources( &self ) -> impl IterTrait< '_, SourceFile > { @@ -163,14 +163,14 @@ mod private WalkDir::new( crate_dir ) .into_iter() .filter_map( Result::ok ) - .filter( | e | e.path().extension().map_or( false, | ext | ext == "rs" ) ) + .filter( | e | e.path().extension().is_some_and(| ext | ext == "rs") ) // fix clippy .map( | e | SourceFile::try_from( e.path() ).unwrap() ) .collect::< Vec< _ > >() .into_iter() } } - impl< 'a > CodeItems for WorkspacePackageRef< 'a > + impl CodeItems for WorkspacePackageRef< '_ > // fix clippy { fn items( &self ) -> impl IterTrait< '_, syn::Item > { @@ -181,7 +181,7 @@ mod private } } - impl< 'a > AsCode for WorkspacePackageRef< 'a > + impl AsCode for WorkspacePackageRef< '_ > // fix clippy { fn as_code( &self ) -> std::io::Result< Cow< '_, str > > { diff --git a/module/move/willbe/src/tool/files.rs b/module/move/willbe/src/tool/files.rs index 5b70f48535..fcd7413abd 100644 --- a/module/move/willbe/src/tool/files.rs +++ b/module/move/willbe/src/tool/files.rs @@ -13,7 +13,6 @@ mod private /// /// # Panics /// qqq: doc - /* xxx : check */ #[ allow( clippy::useless_conversion ) ] pub fn find< P, S >( base_dir : P, patterns : &[ S ] ) -> Vec< PathBuf > diff --git a/module/move/willbe/src/tool/git.rs b/module/move/willbe/src/tool/git.rs index 471d5e5abe..b9f2761a58 100644 --- a/module/move/willbe/src/tool/git.rs +++ b/module/move/willbe/src/tool/git.rs @@ -182,9 +182,7 @@ mod private /// /// # Errors /// qqq: doc - // qqq : should be typed error, apply err_with - pub fn reset< P >( path : P, hard : bool, commits_count : usize, dry : bool ) -> error::untyped::Result< Report > // qqq : don't use 1-prameter Result @@ -239,10 +237,8 @@ mod private /// /// # Errors /// qqq: doc - // qqq : should be typed error, apply err_with // qqq : don't use 1-prameter Result - pub fn ls_remote_url< P >( path : P ) -> error::untyped::Result< Report > where P : AsRef< Path >, diff --git a/module/move/willbe/src/tool/graph.rs b/module/move/willbe/src/tool/graph.rs index 89883cbb8a..9f632778bf 100644 --- a/module/move/willbe/src/tool/graph.rs +++ b/module/move/willbe/src/tool/graph.rs @@ -265,7 +265,6 @@ mod private /// /// # Panics /// qqq: doc - // qqq : for Bohdan : typed error #[ allow( clippy::single_match, clippy::needless_pass_by_value, clippy::implicit_hasher ) ] pub fn remove_not_required_to_publish diff --git a/module/move/willbe/tests/inc/action_tests/cicd_renew.rs b/module/move/willbe/tests/inc/action_tests/cicd_renew.rs index 75370b0db5..ee2bb2848a 100644 --- a/module/move/willbe/tests/inc/action_tests/cicd_renew.rs +++ b/module/move/willbe/tests/inc/action_tests/cicd_renew.rs @@ -90,7 +90,7 @@ fn default_case() }; // Act - _ = action::cicd_renew::action( &temp ).unwrap(); + () = action::cicd_renew::action( &temp ).unwrap(); dbg!( &file_path ); // Assert diff --git a/module/move/willbe/tests/inc/action_tests/list/format.rs b/module/move/willbe/tests/inc/action_tests/list/format.rs index 84b7f32a96..62fbd21924 100644 --- a/module/move/willbe/tests/inc/action_tests/list/format.rs +++ b/module/move/willbe/tests/inc/action_tests/list/format.rs @@ -56,13 +56,13 @@ fn node_with_depth_two_leaves_stop_spacer() dev_dependencies : vec![], build_dependencies : vec![], }; - let expected = r#" + let expected = r" node ├─ sub_node1 │ └─ sub_sub_node1 └─ sub_node2 └─ sub_sub_node2 -"#.trim(); +".trim(); let printer = TreePrinter::new( &node ); let actual = printer.display_with_spacer( "" ).unwrap(); @@ -116,12 +116,12 @@ fn node_with_depth_two_leaves() dev_dependencies : vec![], build_dependencies : vec![], }; - let expected = r#" + let expected = r" node ├─ sub_node1 │ └─ sub_sub_node └─ sub_node2 -"#.trim(); +".trim(); let printer = TreePrinter::new( &node ); let actual = printer.display_with_spacer( "" ).unwrap(); @@ -162,11 +162,11 @@ fn node_with_depth_one_leaf() dev_dependencies : vec![], build_dependencies : vec![], }; - let expected = r#" + let expected = r" node └─ sub_node └─ sub_sub_node -"#.trim(); +".trim(); let printer = TreePrinter::new( &node ); let actual = printer.display_with_spacer( "" ).unwrap(); @@ -211,12 +211,12 @@ fn node_with_build_dependencies_tree_with_two_leaves() } ], }; - let expected = r#" + let expected = r" node [build-dependencies] ├─ build_sub_node1 └─ build_sub_node2 -"#.trim(); +".trim(); let printer = TreePrinter::new( &node ); let actual = printer.display_with_spacer( "" ).unwrap(); @@ -250,11 +250,11 @@ fn node_with_build_dependencies_tree_with_one_leaf() } ], }; - let expected = r#" + let expected = r" node [build-dependencies] └─ build_sub_node -"#.trim(); +".trim(); let printer = TreePrinter::new( &node ); let actual = printer.display_with_spacer( "" ).unwrap(); @@ -299,12 +299,12 @@ fn node_with_dev_dependencies_tree_with_two_leaves() ], build_dependencies : vec![], }; - let expected = r#" + let expected = r" node [dev-dependencies] ├─ dev_sub_node1 └─ dev_sub_node2 -"#.trim(); +".trim(); let printer = TreePrinter::new( &node ); let actual = printer.display_with_spacer( "" ).unwrap(); @@ -338,11 +338,11 @@ fn node_with_dev_dependencies_tree_with_one_leaf() ], build_dependencies : vec![], }; - let expected = r#" + let expected = r" node [dev-dependencies] └─ dev_sub_node -"#.trim(); +".trim(); let printer = TreePrinter::new( &node ); let actual = printer.display_with_spacer( "" ).unwrap(); @@ -387,11 +387,11 @@ fn node_with_dependencies_tree_with_two_leaves() dev_dependencies : vec![], build_dependencies : vec![], }; - let expected = r#" + let expected = r" node ├─ sub_node1 └─ sub_node2 -"#.trim(); +".trim(); let printer = TreePrinter::new( &node ); let actual = printer.display_with_spacer( "" ).unwrap(); @@ -423,10 +423,10 @@ fn node_with_dependency_tree_with_one_leaf() dev_dependencies : vec![], build_dependencies : vec![], }; - let expected = r#" + let expected = r" node └─ sub_node -"#.trim(); +".trim(); let printer = TreePrinter::new( &node ); let actual = printer.display_with_spacer( "" ).unwrap(); diff --git a/module/move/willbe/tests/inc/action_tests/readme_health_table_renew.rs b/module/move/willbe/tests/inc/action_tests/readme_health_table_renew.rs index 909a186116..de6057a8ba 100644 --- a/module/move/willbe/tests/inc/action_tests/readme_health_table_renew.rs +++ b/module/move/willbe/tests/inc/action_tests/readme_health_table_renew.rs @@ -23,7 +23,7 @@ fn without_any_toml_configurations_test() // Arrange let temp = arrange( "without_any_toml_configurations" ); // Act - _ = action::readme_health_table_renew::orphan::readme_health_table_renew( &temp ).unwrap(); + () = action::readme_health_table_renew::orphan::readme_health_table_renew( &temp ).unwrap(); } #[ test ] @@ -33,7 +33,7 @@ fn tags_should_stay() let temp = arrange( "without_module_toml_configurations" ); // Act - _ = action::readme_health_table_renew::orphan::readme_health_table_renew( &temp ).unwrap(); + () = action::readme_health_table_renew::orphan::readme_health_table_renew( &temp ).unwrap(); // Assert let mut file = std::fs::File::open( temp.path().join( "readme.md" ) ).unwrap(); @@ -52,7 +52,7 @@ fn stability_experimental_by_default() let temp = arrange( "without_module_toml_configurations" ); // Act - _ = action::readme_health_table_renew::orphan::readme_health_table_renew( &temp ).unwrap(); + () = action::readme_health_table_renew::orphan::readme_health_table_renew( &temp ).unwrap(); // Assert let mut file = std::fs::File::open( temp.path().join( "readme.md" ) ).unwrap(); @@ -70,7 +70,7 @@ fn stability_and_repository_from_module_toml() let temp = arrange( "without_workspace_toml_configurations" ); // Act - _ = action::readme_health_table_renew::orphan::readme_health_table_renew( &temp ).unwrap(); + () = action::readme_health_table_renew::orphan::readme_health_table_renew( &temp ).unwrap(); // Assert let mut file = std::fs::File::open( temp.path().join( "readme.md" ) ).unwrap(); @@ -97,17 +97,17 @@ fn variadic_tag_configuration_test() let with_gitpod_only = "-->\r| Module | Sample |\n|--------|:------:|\n"; - let expected = vec![ explicit_all_true_flag, all_true_flag, with_stability_only, with_branches_only, with_docs_only, with_gitpod_only ]; + let expected = [explicit_all_true_flag, all_true_flag, with_stability_only, with_branches_only, with_docs_only, with_gitpod_only]; let temp = arrange( "variadic_tag_configurations" ); // Act - _ = action::readme_health_table_renew::orphan::readme_health_table_renew( &temp ).unwrap(); + () = action::readme_health_table_renew::orphan::readme_health_table_renew( &temp ).unwrap(); // Assert let mut file = std::fs::File::open( temp.path().join( "readme.md" ) ).unwrap(); let mut content = String::new(); _ = file.read_to_string( &mut content ).unwrap(); - for ( index, actual ) in content.split( "###" ).into_iter().enumerate() + for ( index, actual ) in content.split( "###" ).enumerate() { assert!( actual.trim().contains( expected[ index ] ) ); } @@ -121,7 +121,7 @@ fn module_cell() let temp = arrange( "full_config" ); // Act - _ = action::readme_health_table_renew::orphan::readme_health_table_renew( &temp ).unwrap(); + () = action::readme_health_table_renew::orphan::readme_health_table_renew( &temp ).unwrap(); // Assert let mut file = std::fs::File::open( temp.path().join( "readme.md" ) ).unwrap(); @@ -139,7 +139,7 @@ fn stability_cell() let temp = arrange( "full_config" ); // Act - _ = action::readme_health_table_renew::orphan::readme_health_table_renew( &temp ).unwrap(); + () = action::readme_health_table_renew::orphan::readme_health_table_renew( &temp ).unwrap(); // Assert let mut file = std::fs::File::open( temp.path().join( "readme.md" ) ).unwrap(); @@ -157,7 +157,7 @@ fn branches_cell() let temp = arrange( "full_config" ); // Act - _ = action::readme_health_table_renew::orphan::readme_health_table_renew( &temp ).unwrap(); + () = action::readme_health_table_renew::orphan::readme_health_table_renew( &temp ).unwrap(); // Assert let mut file = std::fs::File::open( temp.path().join( "readme.md" ) ).unwrap(); @@ -175,7 +175,7 @@ fn docs_cell() let temp = arrange( "full_config" ); // Act - _ = action::readme_health_table_renew::orphan::readme_health_table_renew( &temp ).unwrap(); + () = action::readme_health_table_renew::orphan::readme_health_table_renew( &temp ).unwrap(); // Assert let mut file = std::fs::File::open( temp.path().join( "readme.md" ) ).unwrap(); @@ -193,7 +193,7 @@ fn sample_cell() let temp = arrange( "full_config" ); // Act - _ = action::readme_health_table_renew::orphan::readme_health_table_renew( &temp ).unwrap(); + () = action::readme_health_table_renew::orphan::readme_health_table_renew( &temp ).unwrap(); // Assert let mut file = std::fs::File::open( temp.path().join( "readme.md" ) ).unwrap(); diff --git a/module/move/willbe/tests/inc/action_tests/readme_modules_headers_renew.rs b/module/move/willbe/tests/inc/action_tests/readme_modules_headers_renew.rs index eed7873ef5..63c9ef91e4 100644 --- a/module/move/willbe/tests/inc/action_tests/readme_modules_headers_renew.rs +++ b/module/move/willbe/tests/inc/action_tests/readme_modules_headers_renew.rs @@ -62,7 +62,7 @@ fn default_stability() // Assert assert!( actual.contains( "[![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental)" ) ); - assert!( !actual.contains( "|" ) ); + assert!( !actual.contains( '|' ) ); // fix clippy } #[ test ] diff --git a/module/move/willbe/tests/inc/action_tests/test.rs b/module/move/willbe/tests/inc/action_tests/test.rs index 67c926cb89..7928e2f802 100644 --- a/module/move/willbe/tests/inc/action_tests/test.rs +++ b/module/move/willbe/tests/inc/action_tests/test.rs @@ -28,13 +28,13 @@ fn fail_test() let project = ProjectBuilder::new( "fail_test" ) .toml_file( "[features]\nenabled = []" ) - .test_file( r#" + .test_file( r" #[test] fn should_fail() { panic!() } - "#) + ") .build( temp ) .unwrap(); let abs = AbsolutePath::try_from( project ).unwrap(); @@ -47,7 +47,7 @@ fn fail_test() .form(); let rep = test( args, false ).unwrap_err().0; - println!( "========= OUTPUT =========\n{}\n==========================", rep ); + println!( "========= OUTPUT =========\n{rep}\n==========================" ); let no_features = rep .failure_reports[ 0 ] @@ -68,12 +68,12 @@ fn fail_build() let project = ProjectBuilder::new( "fail_build" ) .lib_file( "compile_error!( \"achtung\" );" ) .toml_file( "[features]\nenabled = []" ) - .test_file( r#" + .test_file( r" #[test] fn should_pass() { assert!(true); } - "#) + ") .build( temp ) .unwrap(); let abs = AbsolutePath::try_from( project ).unwrap(); @@ -86,7 +86,7 @@ fn fail_build() .form(); let rep = test( args, false ).unwrap_err().0; - println!( "========= OUTPUT =========\n{}\n==========================", rep ); + println!( "========= OUTPUT =========\n{rep}\n==========================" ); let no_features = rep .failure_reports[ 0 ] @@ -105,30 +105,30 @@ fn call_from_workspace_root() let fail_project = ProjectBuilder::new( "fail_test" ) .toml_file( "[features]\nenabled = []" ) - .test_file( r#" + .test_file( r" #[test] fn should_fail123() { panic!() } - "#); + "); let pass_project = ProjectBuilder::new( "apass_test" ) .toml_file( "[features]\nenabled = []" ) - .test_file( r#" + .test_file( r" #[test] fn should_pass() { assert_eq!(1,1); } - "#); + "); let pass_project2 = ProjectBuilder::new( "pass_test2" ) .toml_file( "[features]\nenabled = []" ) - .test_file( r#" + .test_file( r" #[test] fn should_pass() { assert_eq!(1,1); } - "#); + "); let workspace = WorkspaceBuilder::new() .member( fail_project ) @@ -164,12 +164,12 @@ fn plan() let project = ProjectBuilder::new( "plan_test" ) .toml_file( "[features]\nenabled = []" ) - .test_file( r#" + .test_file( r" #[test] fn should_pass() { assert!(true); } - "#) + ") .build( temp ) .unwrap(); let abs = AbsolutePath::try_from( project ).unwrap(); @@ -198,12 +198,12 @@ fn backtrace_should_be() let project = ProjectBuilder::new( "fail_build" ) .toml_file( "[features]\nenabled = []" ) - .test_file( r#" + .test_file( r" #[test] fn fail() { assert!(false); } - "#) + ") .build( temp ) .unwrap(); let abs = AbsolutePath::try_from( project ).unwrap(); @@ -216,7 +216,7 @@ fn backtrace_should_be() .form(); let rep = test( args, false ).unwrap_err().0; - println!( "========= OUTPUT =========\n{}\n==========================", rep ); + println!( "========= OUTPUT =========\n{rep}\n==========================" ); let no_features = rep .failure_reports[ 0 ] diff --git a/module/move/willbe/tests/inc/action_tests/workspace_renew.rs b/module/move/willbe/tests/inc/action_tests/workspace_renew.rs index 4790c39f25..19861082e3 100644 --- a/module/move/willbe/tests/inc/action_tests/workspace_renew.rs +++ b/module/move/willbe/tests/inc/action_tests/workspace_renew.rs @@ -26,7 +26,7 @@ fn default_case() create_dir(temp.join("test_project_name" )).unwrap(); // Act - _ = workspace_renew::action( &temp.path().join( "test_project_name" ), WorkspaceTemplate::default(), "https://github.con/Username/TestRepository".to_string(), vec![ "master".to_string() ] ).unwrap(); + () = workspace_renew::action( &temp.path().join( "test_project_name" ), WorkspaceTemplate::default(), "https://github.con/Username/TestRepository".to_string(), vec![ "master".to_string() ] ).unwrap(); // Assets assert!( temp_path.join( "module" ).exists() ); @@ -41,9 +41,9 @@ fn default_case() let name = "project_name = \"test_project_name\""; let repo_url = "repo_url = \"https://github.con/Username/TestRepository\""; let branches = "branches = [\"master\"]"; - assert!( actual.contains( &name) ); - assert!( actual.contains( &repo_url) ); - assert!( actual.contains( &branches) ); + assert!( actual.contains( name) ); + assert!( actual.contains( repo_url) ); + assert!( actual.contains( branches) ); assert!( temp_path.join( "Makefile" ).exists() ); assert!( temp_path.join( ".cargo" ).exists() ); @@ -57,7 +57,7 @@ fn non_empty_dir() let temp = arrange( "single_module" ); // Act - let r = workspace_renew::action( temp.path(), WorkspaceTemplate::default(), "".to_string(), vec![] ); + let r = workspace_renew::action( temp.path(), WorkspaceTemplate::default(), String::new(), vec![] ); // fix clippy // Assert assert!( r.is_err() ); diff --git a/module/move/willbe/tests/inc/command/tests_run.rs b/module/move/willbe/tests/inc/command/tests_run.rs index 67f6b97c9c..94ec245e31 100644 --- a/module/move/willbe/tests/inc/command/tests_run.rs +++ b/module/move/willbe/tests/inc/command/tests_run.rs @@ -18,12 +18,12 @@ fn status_code_1_on_failure() let project = ProjectBuilder::new( "status_code" ) .toml_file( "" ) - .test_file( r#" + .test_file( r" #[test] fn should_fail() { panic!(); } - "#) + ") .build( temp ) .unwrap(); @@ -42,12 +42,12 @@ fn status_code_not_zero_on_failure() let project = ProjectBuilder::new( "status_code" ) .toml_file( "" ) - .test_file( r#" + .test_file( r" #[test] fn should_fail() { panic!(); } - "#) + ") .build( temp ) .unwrap(); diff --git a/module/move/willbe/tests/inc/entity/features.rs b/module/move/willbe/tests/inc/entity/features.rs index 14cd845879..2b4afacb88 100644 --- a/module/move/willbe/tests/inc/entity/features.rs +++ b/module/move/willbe/tests/inc/entity/features.rs @@ -26,7 +26,7 @@ fn mock_package( features : Vec< ( &str, Vec< &str > ) > ) -> cargo_metadata::Pa "dependencies" : [], "targets" : [], "features" : features_map, - "manifest_path" : "".to_string(), + "manifest_path" : String::new(), // fix clippy "authors" : [], "categories" : [], "keywords" : [], diff --git a/module/move/willbe/tests/inc/entity/version.rs b/module/move/willbe/tests/inc/entity/version.rs index 3251fce27c..840c342b4e 100644 --- a/module/move/willbe/tests/inc/entity/version.rs +++ b/module/move/willbe/tests/inc/entity/version.rs @@ -1,7 +1,7 @@ use crate::*; use std::path::{ Path, PathBuf }; -use std::str::FromStr; +use core::str::FromStr; use std::io::Write; use assert_fs::prelude::*; use the_module:: @@ -167,7 +167,7 @@ default-features = true let mut root_manifest = Manifest::try_from( root_manifest_dir_absolute_path ).unwrap(); // root_manifest.load().unwrap(); let data = root_manifest.data(); - let current_version_item = data.get( "workspace" ).and_then( | w | w.get( "dependencies" ) ).and_then( | d | d.get( &name ) ).and_then( | p | p.get( "version" ) ).unwrap(); + let current_version_item = data.get( "workspace" ).and_then( | w | w.get( "dependencies" ) ).and_then( | d | d.get( name ) ).and_then( | p | p.get( "version" ) ).unwrap(); // fix clippy let current_version = current_version_item.as_str().unwrap(); assert_eq!( &bumped_version.to_string(), current_version ); } @@ -223,7 +223,7 @@ default-features = true let mut root_manifest = Manifest::try_from( root_manifest_dir_absolute_path ).unwrap(); // root_manifest.load().unwrap(); let data = root_manifest.data(); - let current_version_item = data.get( "workspace" ).and_then( | w | w.get( "dependencies" ) ).and_then( | d | d.get( &name ) ).and_then( | p | p.get( "version" ) ).unwrap(); + let current_version_item = data.get( "workspace" ).and_then( | w | w.get( "dependencies" ) ).and_then( | d | d.get( name ) ).and_then( | p | p.get( "version" ) ).unwrap(); let current_version = current_version_item.as_str().unwrap(); assert_eq!( &version.to_string(), current_version ); } diff --git a/module/move/willbe/tests/inc/helper.rs b/module/move/willbe/tests/inc/helper.rs index 2efa341f9d..a4413e0746 100644 --- a/module/move/willbe/tests/inc/helper.rs +++ b/module/move/willbe/tests/inc/helper.rs @@ -7,7 +7,7 @@ use std:: io::Write, }; -pub const BINARY_NAME : &'static str = "will"; +pub const BINARY_NAME : &str = "will"; // fix clippy #[ derive( Debug ) ] pub struct ProjectBuilder @@ -59,19 +59,19 @@ impl ProjectBuilder if let Some( content ) = &self.toml_content { let mut file = File::create( project_path.join( "Cargo.toml" ) )?; - write!( file, "{}", content )?; + write!( file, "{content}" )?; // fix clippy } let mut file = File::create( project_path.join( "src/lib.rs" ) )?; if let Some( content ) = &self.lib_content { - write!( file, "{}", content )?; + write!( file, "{content}" )?; // fix clippy } if let Some( content ) = &self.test_content { let mut file = File::create( project_path.join( "tests/tests.rs" ) )?; - write!( file, "{}", content )?; + write!( file, "{content}" )?; // fix clippy } Ok( project_path.to_path_buf() ) diff --git a/module/move/willbe/tests/inc/package.rs b/module/move/willbe/tests/inc/package.rs index 6c820d100e..c9b84d5a89 100644 --- a/module/move/willbe/tests/inc/package.rs +++ b/module/move/willbe/tests/inc/package.rs @@ -18,7 +18,7 @@ impl Dependency Dependency::Normal { name, path, is_macro } if !is_macro => if let Some( path ) = path { - format!( "[dependencies.{name}]\npath = \"../{}\"", path.display().to_string().replace( "\\", "/" ) ) + format!( "[dependencies.{name}]\npath = \"../{}\"", path.display().to_string().replace( '\\', "/" ) ) // fix clippy } else { @@ -28,7 +28,7 @@ impl Dependency Dependency::Dev { name, path, is_macro } if !is_macro => if let Some( path ) = path { - format!( "[dev-dependencies.{name}]\npath = \"../{}\"", path.display().to_string().replace( "\\", "/" ) ) + format!( "[dev-dependencies.{name}]\npath = \"../{}\"", path.display().to_string().replace( '\\', "/" ) ) // fix clippy } else { @@ -82,7 +82,7 @@ impl TestPackage let path = path.as_ref().join( &self.name ); () = fs::create_dir_all( path.join( "src" ) )?; - () = fs::write( path.join( "src" ).join( "lib.rs" ), &[] )?; + () = fs::write( path.join( "src" ).join( "lib.rs" ), [] )?; let cargo = format! ( @@ -250,7 +250,7 @@ fn kos_plan() let the_patterns: Vec< String > = workspace .packages .iter() - .flat_map( | p | p.path.as_ref().map( | p | p.to_string_lossy().into_owned() ) ) + .filter_map( | p | p.path.as_ref().map( | p | p.to_string_lossy().into_owned() ) ) // fix clippy .collect(); dbg!(&the_patterns); diff --git a/module/move/willbe/tests/inc/tool/graph_test.rs b/module/move/willbe/tests/inc/tool/graph_test.rs index 0ad57fa024..d2a195c3a6 100644 --- a/module/move/willbe/tests/inc/tool/graph_test.rs +++ b/module/move/willbe/tests/inc/tool/graph_test.rs @@ -11,11 +11,11 @@ struct IndexMap< T >( HashMap< T, usize > ); impl< T > IndexMap< T > where - T : std::hash::Hash + Eq, + T : core::hash::Hash + Eq, // fix clippy { pub fn new( elements : Vec< T > ) -> Self { - let index_map = elements.into_iter().enumerate().map( |( index, value )| ( value, index ) ).collect(); + let index_map = elements.into_iter().enumerate().map( | ( index, value ) | ( value, index ) ).collect(); Self( index_map ) } @@ -142,7 +142,7 @@ fn simple_case() let groups = topological_sort_with_grouping( graph ); assert_eq!( groups[ 0 ], vec![ "A" ] ); - assert_eq!( groups[1].len(), 2 ); + assert_eq!( groups[ 1 ].len(), 2 ); assert!( groups[ 1 ].contains( &"C" ) ); assert!( groups[ 1 ].contains( &"B" ) ); } @@ -198,18 +198,18 @@ fn complicated_test() let groups = topological_sort_with_grouping( graph ); - dbg!(&groups); + dbg!( &groups ); assert_eq!( groups[ 0 ], vec![ "0" ] ); - assert_eq!( groups[1].len(), 3 ); + assert_eq!( groups[ 1 ].len(), 3 ); assert!( groups[ 1 ].contains( &"6" ) ); assert!( groups[ 1 ].contains( &"5" ) ); assert!( groups[ 1 ].contains( &"4" ) ); assert_eq!( groups[ 2 ], vec![ "3" ] ); - assert_eq!( groups[3].len(), 3 ); + assert_eq!( groups[ 3 ].len(), 3 ); assert!( groups[ 3 ].contains( &"1" ) ); assert!( groups[ 3 ].contains( &"2" ) ); assert!( groups[ 3 ].contains( &"7" ) ); diff --git a/module/move/willbe/tests/inc/tool/query_test.rs b/module/move/willbe/tests/inc/tool/query_test.rs index fa98f5fab1..9a53d60127 100644 --- a/module/move/willbe/tests/inc/tool/query_test.rs +++ b/module/move/willbe/tests/inc/tool/query_test.rs @@ -6,7 +6,7 @@ use the_module::query:: Value, }; use the_module::collection::HashMap; -use std::str::FromStr; +use core::str::FromStr; #[ test ] fn value_from_str() @@ -19,11 +19,11 @@ fn value_from_str() #[ test ] fn bool_from_value() { - assert_eq!( bool::from( &Value::Bool( true ) ), true ); - assert_eq!( bool::from( &Value::String( "true".to_string() ) ), true ); - assert_eq!( bool::from( &Value::Int( 1 ) ), true ); - assert_eq!( bool::from( &Value::Int( 0 ) ), false); - assert_eq!( bool::from( &Value::String( "test".to_string() ) ), false); + assert!( bool::from( &Value::Bool( true ) ) ); + assert!( bool::from( &Value::String( "true".to_string() ) ) ); + assert!( bool::from( &Value::Int( 1 ) ) ); + assert!( !bool::from( &Value::Int( 0 ) ) ); + assert!( !bool::from( &Value::String( "test".to_string() ) ) ); } #[ test ] @@ -37,9 +37,9 @@ fn parse_result_convert() let mixed_map = result.clone().into_map( vec![ "var0".into() ] ); let vec = result.into_vec(); - assert_eq!( HashMap::from( [( "var0".to_string(),Value::Int( 1 )), ( "var1".to_string(),Value::Int( 2 )), ( "var2".to_string(),Value::Int( 3 )) ]), named_map ); - assert_eq!( HashMap::from( [( "1".to_string(),Value::Int( 1 )), ( "2".to_string(),Value::Int( 2 )), ( "3".to_string(),Value::Int( 3 )) ]), unnamed_map ); - assert_eq!( HashMap::from( [( "var0".to_string(),Value::Int( 1 )), ( "1".to_string(),Value::Int( 2 )), ( "2".to_string(),Value::Int( 3 )) ]), mixed_map ); + assert_eq!( HashMap::from( [ ( "var0".to_string(),Value::Int( 1 ) ), ( "var1".to_string(),Value::Int( 2 ) ), ( "var2".to_string(),Value::Int( 3 ) ) ] ), named_map ); + assert_eq!( HashMap::from( [ ( "1".to_string(),Value::Int( 1 ) ), ( "2".to_string(),Value::Int( 2 ) ), ( "3".to_string(),Value::Int( 3 ) ) ] ), unnamed_map ); + assert_eq!( HashMap::from( [ ( "var0".to_string(),Value::Int( 1 ) ), ( "1".to_string(),Value::Int( 2 ) ), ( "2".to_string(),Value::Int( 3 ) ) ] ), mixed_map ); assert_eq!( vec![ Value::Int( 1 ), Value::Int( 2 ), Value::Int( 3 ) ], vec ); } @@ -54,7 +54,7 @@ fn parse_single_value() { let mut expected_map = HashMap::new(); expected_map.insert( "1".to_string(), Value::String( "test/test".to_string() ) ); - assert_eq!( parse( "('test/test')" ).unwrap().into_map(vec![]), expected_map ); + assert_eq!( parse( "('test/test')" ).unwrap().into_map( vec![] ), expected_map ); } #[ test ] @@ -63,7 +63,7 @@ fn parse_multiple_values() let mut expected_map = HashMap::new(); expected_map.insert( "key1".to_string(), Value::Int( 123 ) ); expected_map.insert( "key2".to_string(), Value::Bool( true ) ); - assert_eq!( parse( "{key1 : 123, key2 : true}" ).unwrap().into_map(vec![]), expected_map ); + assert_eq!( parse( "{key1 : 123, key2 : true}" ).unwrap().into_map( vec![] ), expected_map ); } #[ test ] @@ -71,7 +71,7 @@ fn parse_with_quotes() { let mut expected_map = HashMap::new(); expected_map.insert( "key".to_string(), Value::String( "hello world".to_string() ) ); - assert_eq!( parse( "{key : 'hello world'}" ).unwrap().into_map(vec![]), expected_map ); + assert_eq!( parse( "{key : 'hello world'}" ).unwrap().into_map( vec![] ), expected_map ); } #[ test ] @@ -79,7 +79,7 @@ fn parse_with_special_characters() { let mut expected_map = HashMap::new(); expected_map.insert( "key".to_string(), Value::String( "!@#$%^&*(),".to_string() ) ); - assert_eq!( parse( "{key : '!@#$%^&*(),'}" ).unwrap().into_map(vec![]), expected_map ); + assert_eq!( parse( "{key : '!@#$%^&*(),'}" ).unwrap().into_map( vec![] ), expected_map ); } @@ -88,7 +88,7 @@ fn parse_with_colon_in_value() { let mut expected_map = HashMap::new(); expected_map.insert( "key".to_string(), Value::String( "hello :world".to_string() ) ); - assert_eq!( parse( "{key : 'hello :world'}" ).unwrap().into_map(vec![]), expected_map ); + assert_eq!( parse( "{key : 'hello :world'}" ).unwrap().into_map( vec![] ), expected_map ); } #[ test ] @@ -96,15 +96,15 @@ fn with_comma_in_value() { let mut expected_map = HashMap::new(); expected_map.insert( "key".to_string(), Value::String( "hello,world".to_string() ) ); - assert_eq!( parse( "{key : 'hello,world'}" ).unwrap().into_map(vec![]), expected_map ); + assert_eq!( parse( "{key : 'hello,world'}" ).unwrap().into_map( vec![] ), expected_map ); } #[ test ] fn with_single_quote_escape() { let mut expected_map = HashMap::new(); - expected_map.insert( "key".to_string(), Value::String( r#"hello\'test\'test"#.into() ) ); - assert_eq!( parse( r#"{ key : 'hello\'test\'test' }"# ).unwrap().into_map(vec![]), expected_map ); + expected_map.insert( "key".to_string(), Value::String( r"hello\'test\'test".into() ) ); + assert_eq!( parse( r"{ key : 'hello\'test\'test' }" ).unwrap().into_map( vec![] ), expected_map ); } #[ test ] @@ -113,7 +113,7 @@ fn with_multiple_spaces() let mut expected_map = HashMap::new(); expected_map.insert( "key".to_string(), Value::String( "test ".into() ) ); expected_map.insert( "key2".to_string(), Value::String( "test".into() ) ); - assert_eq!( parse( r#"{ key : 'test ', key2 : test }"# ).unwrap().into_map(vec![]), expected_map ); + assert_eq!( parse( r"{ key : 'test ', key2 : test }" ).unwrap().into_map( vec![] ), expected_map ); } #[ test ] @@ -124,7 +124,7 @@ fn many_unnamed() ( "1".to_string(), Value::Int( 123 ) ), ( "2".to_string(), Value::String( "test_aboba".to_string() ) ), ] ); - assert_eq!( parse( "( 123, 'test_aboba' )").unwrap().into_map(vec![]), expected ); + assert_eq!( parse( "( 123, 'test_aboba' )").unwrap().into_map( vec![] ), expected ); } #[ test ] @@ -136,5 +136,5 @@ fn named_and_unnamed() ( "2".to_string(), Value::String( "test_aboba".to_string() ) ), ( "3".to_string(), Value::String("test : true".to_string())) ] ); - assert_eq!( parse( r#"(123, 'test_aboba', test : true)"#).unwrap().into_map(vec![]), expected ); + assert_eq!( parse( r"(123, 'test_aboba', test : true)").unwrap().into_map( vec![] ), expected ); }