Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions cargo-typify/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ pub enum IdOrName {
Id(uuid::Uuid),
Name(Name),
}
impl From<&IdOrName> for IdOrName {
fn from(value: &IdOrName) -> Self {
value.clone()
}
}
impl std::str::FromStr for IdOrName {
type Err = &'static str;
fn from_str(value: &str) -> Result<Self, &'static str> {
Expand Down Expand Up @@ -139,11 +134,6 @@ impl From<Name> for String {
value.0
}
}
impl From<&Name> for Name {
fn from(value: &Name) -> Self {
value.clone()
}
}
impl std::str::FromStr for Name {
type Err = &'static str;
fn from_str(value: &str) -> Result<Self, &'static str> {
Expand Down
20 changes: 0 additions & 20 deletions cargo-typify/tests/outputs/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ impl ::std::convert::From<Fruit>
value.0
}
}
impl ::std::convert::From<&Fruit> for Fruit {
fn from(value: &Fruit) -> Self {
value.clone()
}
}
impl ::std::convert::From<::std::collections::HashMap<::std::string::String, ::std::string::String>>
for Fruit
{
Expand Down Expand Up @@ -105,11 +100,6 @@ pub enum FruitOrVeg {
Veg(Veggie),
Fruit(Fruit),
}
impl ::std::convert::From<&Self> for FruitOrVeg {
fn from(value: &FruitOrVeg) -> Self {
value.clone()
}
}
impl ::std::convert::From<Veggie> for FruitOrVeg {
fn from(value: Veggie) -> Self {
Self::Veg(value)
Expand Down Expand Up @@ -153,11 +143,6 @@ pub struct Veggie {
#[serde(rename = "veggieName")]
pub veggie_name: ::std::string::String,
}
impl ::std::convert::From<&Veggie> for Veggie {
fn from(value: &Veggie) -> Self {
value.clone()
}
}
impl Veggie {
pub fn builder() -> builder::Veggie {
Default::default()
Expand Down Expand Up @@ -197,11 +182,6 @@ pub struct Veggies {
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub vegetables: ::std::vec::Vec<Veggie>,
}
impl ::std::convert::From<&Veggies> for Veggies {
fn from(value: &Veggies) -> Self {
value.clone()
}
}
impl ::std::default::Default for Veggies {
fn default() -> Self {
Self {
Expand Down
20 changes: 0 additions & 20 deletions cargo-typify/tests/outputs/custom_btree_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ impl ::std::convert::From<Fruit>
value.0
}
}
impl ::std::convert::From<&Fruit> for Fruit {
fn from(value: &Fruit) -> Self {
value.clone()
}
}
impl
::std::convert::From<::std::collections::BTreeMap<::std::string::String, ::std::string::String>>
for Fruit
Expand Down Expand Up @@ -106,11 +101,6 @@ pub enum FruitOrVeg {
Veg(Veggie),
Fruit(Fruit),
}
impl ::std::convert::From<&Self> for FruitOrVeg {
fn from(value: &FruitOrVeg) -> Self {
value.clone()
}
}
impl ::std::convert::From<Veggie> for FruitOrVeg {
fn from(value: Veggie) -> Self {
Self::Veg(value)
Expand Down Expand Up @@ -154,11 +144,6 @@ pub struct Veggie {
#[serde(rename = "veggieName")]
pub veggie_name: ::std::string::String,
}
impl ::std::convert::From<&Veggie> for Veggie {
fn from(value: &Veggie) -> Self {
value.clone()
}
}
impl Veggie {
pub fn builder() -> builder::Veggie {
Default::default()
Expand Down Expand Up @@ -198,11 +183,6 @@ pub struct Veggies {
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub vegetables: ::std::vec::Vec<Veggie>,
}
impl ::std::convert::From<&Veggies> for Veggies {
fn from(value: &Veggies) -> Self {
value.clone()
}
}
impl ::std::default::Default for Veggies {
fn default() -> Self {
Self {
Expand Down
20 changes: 0 additions & 20 deletions cargo-typify/tests/outputs/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ impl ::std::convert::From<Fruit>
value.0
}
}
impl ::std::convert::From<&Fruit> for Fruit {
fn from(value: &Fruit) -> Self {
value.clone()
}
}
impl ::std::convert::From<::std::collections::HashMap<::std::string::String, ::std::string::String>>
for Fruit
{
Expand Down Expand Up @@ -105,11 +100,6 @@ pub enum FruitOrVeg {
Veg(Veggie),
Fruit(Fruit),
}
impl ::std::convert::From<&Self> for FruitOrVeg {
fn from(value: &FruitOrVeg) -> Self {
value.clone()
}
}
impl ::std::convert::From<Veggie> for FruitOrVeg {
fn from(value: Veggie) -> Self {
Self::Veg(value)
Expand Down Expand Up @@ -153,11 +143,6 @@ pub struct Veggie {
#[serde(rename = "veggieName")]
pub veggie_name: ::std::string::String,
}
impl ::std::convert::From<&Veggie> for Veggie {
fn from(value: &Veggie) -> Self {
value.clone()
}
}
#[doc = "A representation of a person, company, organization, or place"]
#[doc = r""]
#[doc = r" <details><summary>JSON schema</summary>"]
Expand Down Expand Up @@ -192,11 +177,6 @@ pub struct Veggies {
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub vegetables: ::std::vec::Vec<Veggie>,
}
impl ::std::convert::From<&Veggies> for Veggies {
fn from(value: &Veggies) -> Self {
value.clone()
}
}
impl ::std::default::Default for Veggies {
fn default() -> Self {
Self {
Expand Down
20 changes: 0 additions & 20 deletions cargo-typify/tests/outputs/multi_derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ impl ::std::convert::From<Fruit>
value.0
}
}
impl ::std::convert::From<&Fruit> for Fruit {
fn from(value: &Fruit) -> Self {
value.clone()
}
}
impl ::std::convert::From<::std::collections::HashMap<::std::string::String, ::std::string::String>>
for Fruit
{
Expand Down Expand Up @@ -109,11 +104,6 @@ pub enum FruitOrVeg {
Veg(Veggie),
Fruit(Fruit),
}
impl ::std::convert::From<&Self> for FruitOrVeg {
fn from(value: &FruitOrVeg) -> Self {
value.clone()
}
}
impl ::std::convert::From<Veggie> for FruitOrVeg {
fn from(value: Veggie) -> Self {
Self::Veg(value)
Expand Down Expand Up @@ -159,11 +149,6 @@ pub struct Veggie {
#[serde(rename = "veggieName")]
pub veggie_name: ::std::string::String,
}
impl ::std::convert::From<&Veggie> for Veggie {
fn from(value: &Veggie) -> Self {
value.clone()
}
}
#[doc = "A representation of a person, company, organization, or place"]
#[doc = r""]
#[doc = r" <details><summary>JSON schema</summary>"]
Expand Down Expand Up @@ -200,11 +185,6 @@ pub struct Veggies {
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub vegetables: ::std::vec::Vec<Veggie>,
}
impl ::std::convert::From<&Veggies> for Veggies {
fn from(value: &Veggies) -> Self {
value.clone()
}
}
impl ::std::default::Default for Veggies {
fn default() -> Self {
Self {
Expand Down
20 changes: 0 additions & 20 deletions cargo-typify/tests/outputs/no-builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ impl ::std::convert::From<Fruit>
value.0
}
}
impl ::std::convert::From<&Fruit> for Fruit {
fn from(value: &Fruit) -> Self {
value.clone()
}
}
impl ::std::convert::From<::std::collections::HashMap<::std::string::String, ::std::string::String>>
for Fruit
{
Expand Down Expand Up @@ -105,11 +100,6 @@ pub enum FruitOrVeg {
Veg(Veggie),
Fruit(Fruit),
}
impl ::std::convert::From<&Self> for FruitOrVeg {
fn from(value: &FruitOrVeg) -> Self {
value.clone()
}
}
impl ::std::convert::From<Veggie> for FruitOrVeg {
fn from(value: Veggie) -> Self {
Self::Veg(value)
Expand Down Expand Up @@ -153,11 +143,6 @@ pub struct Veggie {
#[serde(rename = "veggieName")]
pub veggie_name: ::std::string::String,
}
impl ::std::convert::From<&Veggie> for Veggie {
fn from(value: &Veggie) -> Self {
value.clone()
}
}
#[doc = "A representation of a person, company, organization, or place"]
#[doc = r""]
#[doc = r" <details><summary>JSON schema</summary>"]
Expand Down Expand Up @@ -192,11 +177,6 @@ pub struct Veggies {
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub vegetables: ::std::vec::Vec<Veggie>,
}
impl ::std::convert::From<&Veggies> for Veggies {
fn from(value: &Veggies) -> Self {
value.clone()
}
}
impl ::std::default::Default for Veggies {
fn default() -> Self {
Self {
Expand Down
12 changes: 0 additions & 12 deletions typify-impl/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1489,12 +1489,6 @@ mod tests {
Err(::std::string::String),
}

impl ::std::convert::From<&Self> for ResultX {
fn from(value: &ResultX) -> Self {
value.clone()
}
}

impl ::std::convert::From<u32> for ResultX {
fn from(value: u32) -> Self {
Self::Ok(value)
Expand Down Expand Up @@ -1541,12 +1535,6 @@ mod tests {
Err(::std::string::String),
}

impl ::std::convert::From<&Self> for ResultX {
fn from(value: &ResultX) -> Self {
value.clone()
}
}

impl ::std::convert::From<u32> for ResultX {
fn from(value: u32) -> Self {
Self::Ok(value)
Expand Down
18 changes: 0 additions & 18 deletions typify-impl/src/type_entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1082,12 +1082,6 @@ impl TypeEntry {
#(#variants_decl)*
}

impl ::std::convert::From<&Self> for #type_name {
fn from(value: &#type_name) -> Self {
value.clone()
}
}

#simple_enum_impl
#default_impl
#untagged_newtype_from_string_impl
Expand Down Expand Up @@ -1204,12 +1198,6 @@ impl TypeEntry {
pub #prop_name: #prop_type,
)*
}

impl ::std::convert::From<&#type_name> for #type_name {
fn from(value: &#type_name) -> Self {
value.clone()
}
}
},
);

Expand Down Expand Up @@ -1677,12 +1665,6 @@ impl TypeEntry {
}
}

impl ::std::convert::From<&#type_name> for #type_name {
fn from(value: &#type_name) -> Self {
value.clone()
}
}

#default_impl
#constraint_impl
};
Expand Down
20 changes: 0 additions & 20 deletions typify-impl/tests/generator.out
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@ mod types {
pub struct AllTheTraits {
pub ok: ::std::string::String,
}
impl ::std::convert::From<&AllTheTraits> for AllTheTraits {
fn from(value: &AllTheTraits) -> Self {
value.clone()
}
}
impl AllTheTraits {
pub fn builder() -> builder::AllTheTraits {
Default::default()
Expand Down Expand Up @@ -99,11 +94,6 @@ mod types {
pub value1: ::std::string::String,
pub value2: u64,
}
impl ::std::convert::From<&CompoundType> for CompoundType {
fn from(value: &CompoundType) -> Self {
value.clone()
}
}
impl CompoundType {
pub fn builder() -> builder::CompoundType {
Default::default()
Expand Down Expand Up @@ -137,11 +127,6 @@ mod types {
#[serde(default = "defaults::pair_b")]
pub b: StringEnum,
}
impl ::std::convert::From<&Pair> for Pair {
fn from(value: &Pair) -> Self {
value.clone()
}
}
impl ::std::default::Default for Pair {
fn default() -> Self {
Self {
Expand Down Expand Up @@ -188,11 +173,6 @@ mod types {
Two,
BuckleMyShoe,
}
impl ::std::convert::From<&Self> for StringEnum {
fn from(value: &StringEnum) -> Self {
value.clone()
}
}
impl ::std::fmt::Display for StringEnum {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Expand Down
Loading