Skip to content

Commit ffea267

Browse files
authored
refactor!: remove non-idiomatic From<&String> trait impls (#946)
1 parent 1ddaa37 commit ffea267

4 files changed

Lines changed: 0 additions & 34 deletions

File tree

cargo-typify/README.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,6 @@ impl std::convert::TryFrom<&str> for IdOrName {
9090
value.parse()
9191
}
9292
}
93-
impl std::convert::TryFrom<&String> for IdOrName {
94-
type Error = &'static str;
95-
fn try_from(value: &String) -> Result<Self, &'static str> {
96-
value.parse()
97-
}
98-
}
9993
impl std::convert::TryFrom<String> for IdOrName {
10094
type Error = &'static str;
10195
fn try_from(value: String) -> Result<Self, &'static str> {
@@ -156,12 +150,6 @@ impl std::convert::TryFrom<&str> for Name {
156150
value.parse()
157151
}
158152
}
159-
impl std::convert::TryFrom<&String> for Name {
160-
type Error = &'static str;
161-
fn try_from(value: &String) -> Result<Self, &'static str> {
162-
value.parse()
163-
}
164-
}
165153
impl std::convert::TryFrom<String> for Name {
166154
type Error = &'static str;
167155
fn try_from(value: String) -> Result<Self, &'static str> {

typify-impl/src/type_entry.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,16 +1427,6 @@ impl TypeEntry {
14271427
value.parse()
14281428
}
14291429
}
1430-
impl ::std::convert::TryFrom<&String> for #type_name {
1431-
type Error = <#inner_type_name as
1432-
::std::str::FromStr>::Err;
1433-
1434-
fn try_from(value: &String) ->
1435-
::std::result::Result<Self, Self::Error>
1436-
{
1437-
value.parse()
1438-
}
1439-
}
14401430
impl ::std::convert::TryFrom<String> for #type_name {
14411431
type Error = <#inner_type_name as
14421432
::std::str::FromStr>::Err;

typify/tests/schemas/merged-schemas.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -529,12 +529,6 @@ impl ::std::convert::TryFrom<&str> for NarrowNumber {
529529
value.parse()
530530
}
531531
}
532-
impl ::std::convert::TryFrom<&String> for NarrowNumber {
533-
type Error = <::std::num::NonZeroU64 as ::std::str::FromStr>::Err;
534-
fn try_from(value: &String) -> ::std::result::Result<Self, Self::Error> {
535-
value.parse()
536-
}
537-
}
538532
impl ::std::convert::TryFrom<String> for NarrowNumber {
539533
type Error = <::std::num::NonZeroU64 as ::std::str::FromStr>::Err;
540534
fn try_from(value: String) -> ::std::result::Result<Self, Self::Error> {

typify/tests/schemas/noisy-types.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,6 @@ impl ::std::convert::TryFrom<&str> for IntegerBs {
114114
value.parse()
115115
}
116116
}
117-
impl ::std::convert::TryFrom<&String> for IntegerBs {
118-
type Error = <u64 as ::std::str::FromStr>::Err;
119-
fn try_from(value: &String) -> ::std::result::Result<Self, Self::Error> {
120-
value.parse()
121-
}
122-
}
123117
impl ::std::convert::TryFrom<String> for IntegerBs {
124118
type Error = <u64 as ::std::str::FromStr>::Err;
125119
fn try_from(value: String) -> ::std::result::Result<Self, Self::Error> {

0 commit comments

Comments
 (0)