Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean and tidy some traits #10967

Merged
merged 2 commits into from
Dec 17, 2013

Conversation

chris-morgan
Copy link
Member

Remove {As,Into,To}{Option,Either,Result} traits.

Expanded, that is:

  • AsOption
  • IntoOption
  • ToOption
  • AsEither
  • IntoEither
  • ToEither
  • AsResult
  • IntoResult
  • ToResult

These were defined for each other but never used anywhere. They are
all trivial and so removal will have negligible effect upon anyone.
Either has fallen out of favour (and its implementation of these
traits of dubious semantics), Option<T>Result<T, ()> was never
really useful and Result<T, E>Option<T> should now be done with
Result.ok() (mirrored with Result.err() for even more usefulness).

In summary, there's really no point in any of these remaining.

Rename To{Str,Bytes}Consume traits to Into*.

That is:

  • ToStrConsumeIntoStr;
  • ToBytesConsumeIntoBytes.

Expanded, that is:

- `AsOption`
- `IntoOption`
- `ToOption`
- `AsEither`
- `IntoEither`
- `ToEither`
- `AsResult`
- `IntoResult`
- `ToResult`

These were defined for each other but never *used* anywhere. They are
all trivial and so removal will have negligible effect upon anyone.
`Either` has fallen out of favour (and its implementation of these
traits of dubious semantics), `Option<T>` → `Result<T, ()>` was never
really useful and `Result<T, E>` → `Option<T>` should now be done with
`Result.ok()` (mirrored with `Result.err()` for even more usefulness).

In summary, there's really no point in any of these remaining.
That is:

- `ToStrConsume` → `IntoStr`;
- `ToBytesConsume` → `IntoBytes`.
@emberian
Copy link
Member

👍

@alexcrichton
Copy link
Member

These are some traits in some core modules, so this should be discussed a little bit.

I am very much in favor of removing these traits.

@alexcrichton
Copy link
Member

I have added this to the agenda for tomorrow's meeting.

bors added a commit that referenced this pull request Dec 17, 2013
…r=alexcrichton

### Remove {As,Into,To}{Option,Either,Result} traits.

Expanded, that is:

- `AsOption`
- `IntoOption`
- `ToOption`
- `AsEither`
- `IntoEither`
- `ToEither`
- `AsResult`
- `IntoResult`
- `ToResult`

These were defined for each other but never *used* anywhere. They are
all trivial and so removal will have negligible effect upon anyone.
`Either` has fallen out of favour (and its implementation of these
traits of dubious semantics), `Option<T>` → `Result<T, ()>` was never
really useful and `Result<T, E>` → `Option<T>` should now be done with
`Result.ok()` (mirrored with `Result.err()` for even more usefulness).

In summary, there's really no point in any of these remaining.

### Rename To{Str,Bytes}Consume traits to Into*.

That is:

- `ToStrConsume` → `IntoStr`;
- `ToBytesConsume` → `IntoBytes`.
@bors bors closed this Dec 17, 2013
@bors bors merged commit b76997f into rust-lang:master Dec 17, 2013
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jun 30, 2023
New lints ['`needless_pub_self`], [`pub_with_shorthand`] and [`pub_without_shorthand`]

Closes rust-lang#10963
Closes rust-lang#10964

changelog: New lints ['`needless_pub_self`], [`pub_with_shorthand`] and [`pub_without_shorthand`]
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.

4 participants