Skip to content

refactor!: remove remaining non-idiomatic TryFrom<&String> trait impls#1040

Open
danieleades wants to merge 1 commit into
oxidecomputer:mainfrom
danieleades:fix/remove-tryfrom-ref-string
Open

refactor!: remove remaining non-idiomatic TryFrom<&String> trait impls#1040
danieleades wants to merge 1 commit into
oxidecomputer:mainfrom
danieleades:fix/remove-tryfrom-ref-string

Conversation

@danieleades

Copy link
Copy Markdown
Contributor

#946 removed the non-idiomatic TryFrom<&String> impl at one emission site (newtypes proxying an inner type's FromStr), but three other sites still generate the same impl:

  • simple string enums
  • untagged newtype enums with FromStr conversion
  • string-constrained newtypes

This removes all three, completing #946. TryFrom<&str> covers &String callers via deref coercion, and TryFrom<String> remains for owned values. −7,143 lines across the test goldens (835 impl blocks).

Breaking for any caller spelling T::try_from(&string) where inference relied on the &String impl — same trade-off as accepted in #946.

oxidecomputer#946 removed the TryFrom<&String> impl generated for newtypes that
proxy an inner type's FromStr, but three other emission sites still
produced the same non-idiomatic impl: simple string enums, untagged
newtype enums with FromStr conversion, and string-constrained
newtypes. Remove them all; TryFrom<&str> covers callers via deref
coercion, and TryFrom<String> remains for owned values.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant