Skip to content

Commit 0b57522

Browse files
committed
fixup
Signed-off-by: tison <wander4096@gmail.com>
1 parent 3e2471b commit 0b57522

6 files changed

Lines changed: 19 additions & 8 deletions

File tree

impl/src/from_str.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ struct FlatExpansion<'i> {
133133
/// a value-specific [`attr::RenameAll`] overriding [`FlatExpansion::rename_all`], if any.
134134
///
135135
/// [`syn::Ident`]: struct@syn::Ident
136+
#[allow(clippy::type_complexity)]
136137
matches: Vec<(
137138
&'i syn::Ident,
138139
Either<&'i syn::DataStruct, &'i syn::Variant>,
@@ -177,8 +178,8 @@ impl<'i> TryFrom<&'i syn::DeriveInput> for FlatExpansion<'i> {
177178
vec![(
178179
&input.ident,
179180
Either::Left(data),
180-
rename.clone(),
181-
rename_all.clone(),
181+
rename,
182+
rename_all,
182183
)]
183184
}
184185
syn::Data::Enum(data) => data
@@ -555,7 +556,9 @@ impl attr::ParseMultiple for FlatVariantAttributes {
555556
if new.rename.and_then(|n| prev.rename.replace(n)).is_some() {
556557
return Err(syn::Error::new(
557558
new_span,
558-
format!("multiple `#[{name}(rename=\"...\")]` attributes aren't allowed"),
559+
format!(
560+
"multiple `#[{name}(rename=\"...\")]` attributes aren't allowed"
561+
),
559562
));
560563
}
561564

@@ -650,7 +653,9 @@ impl attr::ParseMultiple for FlatContainerAttributes {
650653
if new.rename.and_then(|n| prev.rename.replace(n)).is_some() {
651654
return Err(syn::Error::new(
652655
new_span,
653-
format!("multiple `#[{name}(rename=\"...\")]` attributes aren't allowed"),
656+
format!(
657+
"multiple `#[{name}(rename=\"...\")]` attributes aren't allowed"
658+
),
654659
));
655660
}
656661

impl/src/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,9 +1540,9 @@ pub(crate) mod attr {
15401540
))]
15411541
pub(crate) use self::forward::Forward;
15421542
#[cfg(any(feature = "display", feature = "from_str"))]
1543-
pub(crate) use self::rename_all::RenameAll;
1544-
#[cfg(any(feature = "display", feature = "from_str"))]
15451543
pub(crate) use self::rename::Rename;
1544+
#[cfg(any(feature = "display", feature = "from_str"))]
1545+
pub(crate) use self::rename_all::RenameAll;
15461546
#[cfg(any(
15471547
feature = "add",
15481548
feature = "add_assign",

tests/compile_fail/as_mut/renamed_generic.stderr

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ error[E0599]: the method `as_mut` exists for struct `Baz<i32>`, but its trait bo
1313
= note: trait bound `Foo<i32>: AsMut<Foo<i32>>` was not satisfied
1414
note: the trait `AsMut` must be implemented
1515
--> $RUST/core/src/convert/mod.rs
16+
|
17+
| pub const trait AsMut<T: PointeeSized>: PointeeSized {
18+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1619
= help: items from traits can only be used if the trait is implemented and in scope
1720
= note: the following trait defines an item `as_mut`, perhaps you need to implement it:
1821
candidate #1: `AsMut`

tests/compile_fail/as_ref/renamed_generic.stderr

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ error[E0599]: the method `as_ref` exists for struct `Baz<i32>`, but its trait bo
1313
= note: trait bound `Foo<i32>: AsRef<Foo<i32>>` was not satisfied
1414
note: the trait `AsRef` must be implemented
1515
--> $RUST/core/src/convert/mod.rs
16+
|
17+
| pub const trait AsRef<T: PointeeSized>: PointeeSized {
18+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1619
= help: items from traits can only be used if the trait is implemented and in scope
1720
= note: the following trait defines an item `as_ref`, perhaps you need to implement it:
1821
candidate #1: `AsRef`

tests/compile_fail/from_str/enum_unknown_attribute.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: expected `error` or `rename_all`
1+
error: expected one of: `error`, `rename`, `rename_all`
22
--> tests/compile_fail/from_str/enum_unknown_attribute.rs:2:12
33
|
44
2 | #[from_str(unknown = "unknown")]

tests/compile_fail/from_str/struct_flat_unknown_attribute.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: expected `error` or `rename_all`
1+
error: expected one of: `error`, `rename`, `rename_all`
22
--> tests/compile_fail/from_str/struct_flat_unknown_attribute.rs:2:12
33
|
44
2 | #[from_str(unknown = "unknown")]

0 commit comments

Comments
 (0)