Skip to content

Commit b2764fa

Browse files
committed
fix new clippy
1 parent b3e3acc commit b2764fa

File tree

7 files changed

+59
-62
lines changed

7 files changed

+59
-62
lines changed

module/core/clone_dyn_types/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ mod private
190190
unsafe
191191
{
192192
let mut ptr = ref_dyn as *const T;
193-
let data_ptr = &mut ptr as *mut *const T as *mut *mut ();
193+
let data_ptr = &raw mut ptr as *mut *mut (); // fix clippy
194194
*data_ptr = < T as CloneDyn >::__clone_dyn( ref_dyn, DontCallMe );
195195
Box::from_raw( ptr as *mut T )
196196
}

module/core/former_meta/src/derive_former.rs

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#[ allow( clippy::wildcard_imports ) ]
22
use super::*;
3-
use iter_tools::{ Itertools };
3+
use iter_tools::Itertools;
44
use macro_tools::{ attr, diag, generic_params, generic_args, typ, derive, Result };
55
use proc_macro2::TokenStream;
66

@@ -77,7 +77,7 @@ pub fn mutator
7777
{
7878
let debug = format!
7979
(
80-
r#"
80+
r"
8181
= Example of custom mutator
8282
8383
impl< {} > former::FormerMutator
@@ -91,16 +91,16 @@ where
9191
{{
9292
}}
9393
}}
94-
"#,
94+
",
9595
format!( "{}", qt!{ #former_definition_types_generics_impl } ),
9696
format!( "{}", qt!{ #former_definition_types_generics_ty } ),
9797
format!( "{}", qt!{ #former_definition_types_generics_where } ),
9898
);
9999
// println!( "{debug}" );
100100
let about = format!
101101
(
102-
r#"derive : Former
103-
item : {item}"#,
102+
r"derive : Former
103+
item : {item}",
104104
);
105105
diag::report_print( about, original_input, debug );
106106
};
@@ -116,18 +116,18 @@ fn doc_generate( item : &syn::Ident ) -> ( String, String )
116116

117117
let doc_former_mod = format!
118118
(
119-
r#" Implementation of former for [{item}].
120-
"#
119+
r" Implementation of former for [{item}].
120+
"
121121
);
122122

123123
let doc_former_struct = format!
124124
(
125-
r#"
125+
r"
126126
Structure to form [{item}]. Represents a forming entity designed to construct objects through a builder pattern.
127127
128128
This structure holds temporary storage and context during the formation process and
129129
utilizes a defined end strategy to finalize the object creation.
130-
"#
130+
"
131131
);
132132

133133
( doc_former_mod, doc_former_struct )
@@ -144,11 +144,7 @@ pub fn former( input : proc_macro::TokenStream ) -> Result< TokenStream >
144144
use macro_tools::IntoGenericArgs;
145145

146146
let original_input = input.clone();
147-
let ast = match syn::parse::< syn::DeriveInput >( input )
148-
{
149-
Ok( syntax_tree ) => syntax_tree,
150-
Err( err ) => return Err( err ),
151-
};
147+
let ast = syn::parse::< syn::DeriveInput >( input )?;
152148
let has_debug = attr::has_debug( ast.attrs.iter() )?;
153149
let struct_attrs = ItemAttributes::from_attrs( ast.attrs.iter() )?;
154150

@@ -165,12 +161,12 @@ pub fn former( input : proc_macro::TokenStream ) -> Result< TokenStream >
165161

166162
let as_subformer_end_doc = format!
167163
(
168-
r#"
164+
r"
169165
Represents an end condition for former of [`${item}`], tying the lifecycle of forming processes to a broader context.
170166
171167
This trait is intended for use with subformer alias, ensuring that end conditions are met according to the
172168
specific needs of the broader forming context. It mandates the implementation of `former::FormingEnd`.
173-
"#
169+
"
174170
);
175171

176172
/* parameters for structure */

module/core/former_meta/src/derive_former/field.rs

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#[ allow( clippy::wildcard_imports ) ]
22
use super::*;
3-
use macro_tools::{ container_kind };
3+
use macro_tools::container_kind;
44

55
///
66
/// Definition of a field.
@@ -455,7 +455,7 @@ impl< 'a > FormerField< 'a >
455455
{
456456
let debug = format!
457457
(
458-
r#"
458+
r"
459459
impl< Definition > {former}< Definition >
460460
where
461461
Definition : former::FormerDefinition< Storage = {former_storage} >,
@@ -470,14 +470,14 @@ where
470470
self
471471
}}
472472
}}
473-
"#,
473+
",
474474
format!( "{}", qt!{ #typ } ),
475475
);
476476
let about = format!
477477
(
478-
r#"derive : Former
478+
r"derive : Former
479479
item : {item}
480-
field : {field_ident}"#,
480+
field : {field_ident}",
481481
);
482482
diag::report_print( about, original_input, debug );
483483
}
@@ -693,7 +693,7 @@ field : {field_ident}"#,
693693
{
694694
let debug = format!
695695
(
696-
r#"
696+
r"
697697
/// 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.
698698
699699
impl< Definition, > {former}< Definition, >
@@ -713,14 +713,14 @@ where
713713
}}
714714
715715
}}
716-
"#,
716+
",
717717
format!( "{}", qt!{ #( #params, )* } ),
718718
);
719719
let about = format!
720720
(
721-
r#"derive : Former
721+
r"derive : Former
722722
item : {item}
723-
field : {field_ident}"#,
723+
field : {field_ident}",
724724
);
725725
diag::report_print( about, original_input, debug );
726726
}
@@ -736,13 +736,13 @@ field : {field_ident}"#,
736736

737737
let subform_collection_end_doc = format!
738738
(
739-
r#"
739+
r"
740740
A callback structure to manage the final stage of forming a `{0}` for the `{item}` collection.
741741
742742
This callback is used to integrate the contents of a temporary `{0}` back into the original `{item}` former
743743
after the subforming process is completed. It replaces the existing content of the `{field_ident}` field in `{item}`
744744
with the new content generated during the subforming process.
745-
"#,
745+
",
746746
format!( "{}", qt!{ #field_typ } ),
747747
);
748748

@@ -891,7 +891,7 @@ with the new content generated during the subforming process.
891891

892892
let doc = format!
893893
(
894-
r#"
894+
r"
895895
896896
Initiates the addition of {field_ident} to the `{item}` entity using a dedicated subformer.
897897
@@ -905,7 +905,7 @@ parent's structure once formed.
905905
Returns an instance of `Former2`, a subformer ready to begin the formation process for `{0}` entities,
906906
allowing for dynamic and flexible construction of the `{item}` entity's {field_ident}.
907907
908-
"#,
908+
",
909909
format!( "{}", qt!{ #field_typ } ),
910910
);
911911

@@ -946,15 +946,15 @@ allowing for dynamic and flexible construction of the `{item}` entity's {field_i
946946

947947
let doc = format!
948948
(
949-
r#"
949+
r"
950950
Provides a user-friendly interface to add an instancce of {field_ident} to the {item}.
951951
952952
# Returns
953953
954954
Returns an instance of `Former2`, a subformer ready to begin the formation process for `{0}` entities,
955955
allowing for dynamic and flexible construction of the `{item}` entity's {field_ident}.
956956
957-
"#,
957+
",
958958
format!( "{}", qt!{ #field_typ } ),
959959
);
960960

@@ -998,7 +998,7 @@ allowing for dynamic and flexible construction of the `{item}` entity's {field_i
998998
{
999999
let debug = format!
10001000
(
1001-
r#"
1001+
r"
10021002
/// Initializes and configures a subformer for adding named child entities. This method leverages an internal function
10031003
/// to create and return a configured subformer instance. It allows for the dynamic addition of children with specific names,
10041004
/// integrating them into the formation process of the parent entity.
@@ -1016,21 +1016,21 @@ where
10161016
// Replace {0} with name of type of entry value.
10171017
10181018
}}
1019-
"#,
1019+
",
10201020
format!( "{}", qt!{ #entry_typ } ),
10211021
);
10221022
let about = format!
10231023
(
1024-
r#"derive : Former
1024+
r"derive : Former
10251025
item : {item}
1026-
field : {field_ident}"#,
1026+
field : {field_ident}",
10271027
);
10281028
diag::report_print( about, original_input, debug );
10291029
}
10301030

10311031
let doc = format!
10321032
(
1033-
r#"
1033+
r"
10341034
10351035
Implements the `FormingEnd` trait for `{subform_entry_end}` to handle the final
10361036
stage of the forming process for a `{item}` collection that contains `{0}` elements.
@@ -1058,7 +1058,7 @@ preformed elements to this storage.
10581058
Returns the updated `{former}` instance with newly added {field_ident}, completing the
10591059
formation process of the `{item}`.
10601060
1061-
"#,
1061+
",
10621062
format!( "{}", qt!{ #field_typ } ),
10631063
);
10641064

@@ -1179,7 +1179,7 @@ formation process of the `{item}`.
11791179

11801180
let doc = format!
11811181
(
1182-
r#"
1182+
r"
11831183
11841184
Initiates the scalar subformer for a `{0}` entity within a `{item}`.
11851185
@@ -1203,7 +1203,7 @@ is properly initialized with all necessary configurations, including the default
12031203
This function is typically called internally by a more user-friendly method that abstracts away the complex
12041204
generics, providing a cleaner interface for initiating subform operations on scalar fields.
12051205
1206-
"#,
1206+
",
12071207
format!( "{}", qt!{ #field_typ } ),
12081208
);
12091209

@@ -1267,7 +1267,7 @@ generics, providing a cleaner interface for initiating subform operations on sca
12671267

12681268
let doc = format!
12691269
(
1270-
r#"
1270+
r"
12711271
Provides a user-friendly interface to begin subforming a scalar `{0}` field within a `{item}`.
12721272
12731273
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
12771277
providing a straightforward and type-safe interface for client code. It encapsulates details about the specific
12781278
former and end action types, ensuring a seamless developer experience when forming parts of a `{item}`.
12791279
1280-
"#,
1280+
",
12811281
format!( "{}", qt!{ #field_typ } ),
12821282
);
12831283

@@ -1320,7 +1320,7 @@ former and end action types, ensuring a seamless developer experience when formi
13201320
{
13211321
let debug = format!
13221322
(
1323-
r#"
1323+
r"
13241324
/// Extends `{former}` to include a method that initializes and configures a subformer for the '{field_ident}' field.
13251325
/// This function demonstrates the dynamic addition of a named {field_ident}, leveraging a subformer to specify detailed properties.
13261326
@@ -1334,21 +1334,21 @@ where
13341334
self._{field_ident}_subform_scalar::< {0}Former< _ >, _, >().name( name )
13351335
}}
13361336
}}
1337-
"#,
1337+
",
13381338
format!( "{}", qt!{ #field_typ } ),
13391339
);
13401340
let about = format!
13411341
(
1342-
r#"derive : Former
1342+
r"derive : Former
13431343
item : {item}
1344-
field : {field_ident}"#,
1344+
field : {field_ident}",
13451345
);
13461346
diag::report_print( about, original_input, debug );
13471347
}
13481348

13491349
let doc = format!
13501350
(
1351-
r#"
1351+
r"
13521352
13531353
Represents the endpoint for the forming process of a scalar field managed by a subformer within a `{item}` entity.
13541354
@@ -1366,7 +1366,7 @@ Essentially, this end action integrates the individually formed scalar value bac
13661366
- `super_former`: An optional context of the `{former}`, which will receive the value. The function ensures
13671367
that this context is not `None` and inserts the formed value into the designated field within `{item}`'s storage.
13681368
1369-
"#,
1369+
",
13701370
format!( "{}", qt!{ #field_typ } ),
13711371
);
13721372

module/core/former_meta/src/derive_former/field_attrs.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,10 @@ impl syn::parse::Parse for AttributeConfig
206206
syn_err!
207207
(
208208
ident,
209-
r#"Expects an attribute of format '#[ former( default = 13 ) ]'
209+
r"Expects an attribute of format '#[ former( default = 13 ) ]'
210210
{known}
211211
But got: '{}'
212-
"#,
212+
",
213213
qt!{ #ident }
214214
)
215215
};
@@ -368,10 +368,10 @@ impl syn::parse::Parse for AttributeScalarSetter
368368
syn_err!
369369
(
370370
ident,
371-
r#"Expects an attribute of format '#[ scalar( name = myName, setter = true ) ]'
371+
r"Expects an attribute of format '#[ scalar( name = myName, setter = true ) ]'
372372
{known}
373373
But got: '{}'
374-
"#,
374+
",
375375
qt!{ #ident }
376376
)
377377
};
@@ -544,10 +544,10 @@ impl syn::parse::Parse for AttributeSubformScalarSetter
544544
syn_err!
545545
(
546546
ident,
547-
r#"Expects an attribute of format '#[ subform_scalar( name = myName, setter = true ) ]'
547+
r"Expects an attribute of format '#[ subform_scalar( name = myName, setter = true ) ]'
548548
{known}
549549
But got: '{}'
550-
"#,
550+
",
551551
qt!{ #ident }
552552
)
553553
};
@@ -735,10 +735,10 @@ impl syn::parse::Parse for AttributeSubformCollectionSetter
735735
syn_err!
736736
(
737737
ident,
738-
r#"Expects an attribute of format '#[ subform_collection( name = myName, setter = true, debug, definition = MyDefinition ) ]'
738+
r"Expects an attribute of format '#[ subform_collection( name = myName, setter = true, debug, definition = MyDefinition ) ]'
739739
{known}
740740
But got: '{}'
741-
"#,
741+
",
742742
qt!{ #ident }
743743
)
744744
};
@@ -919,10 +919,10 @@ impl syn::parse::Parse for AttributeSubformEntrySetter
919919
syn_err!
920920
(
921921
ident,
922-
r#"Expects an attribute of format '#[ subform( name = myName, setter = true ) ]'
922+
r"Expects an attribute of format '#[ subform( name = myName, setter = true ) ]'
923923
{known}
924924
But got: '{}'
925-
"#,
925+
",
926926
qt!{ #ident }
927927
)
928928
};

0 commit comments

Comments
 (0)