Skip to content

Revise use of conversion traits #23753

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

Merged
merged 1 commit into from
Mar 28, 2015
Merged

Conversation

aturon
Copy link
Member

@aturon aturon commented Mar 26, 2015

This commit revises path and os_str to use blanket impls for From
on reference types. This both cuts down on the number of required impls,
and means that you can pass through e.g. T: AsRef<OsStr> to
PathBuf::from without an intermediate call to as_ref.

It also makes a FIXME note for later generalizing the blanket impls for
AsRef and AsMut to use Deref/DerefMut, once it is possible to do
so.

@rust-highfive
Copy link
Contributor

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

@alexcrichton
Copy link
Member

@bors: r+

Nice catch!

@bors
Copy link
Collaborator

bors commented Mar 26, 2015

📌 Commit 741e8ae has been approved by alexcrichton

This commit revises `path` and `os_str` to use blanket impls for `From`
on reference types. This both cuts down on the number of required impls,
and means that you can pass through e.g. `T: AsRef<OsStr>` to
`PathBuf::from` without an intermediate call to `as_ref`.

It also makes a FIXME note for later generalizing the blanket impls for
`AsRef` and `AsMut` to use `Deref`/`DerefMut`, once it is possible to do
so.
@aturon
Copy link
Member Author

aturon commented Mar 26, 2015

@bors: r=alexcrichton e7525cf

Manishearth added a commit to Manishearth/rust that referenced this pull request Mar 26, 2015
 This commit revises `path` and `os_str` to use blanket impls for `From`
on reference types. This both cuts down on the number of required impls,
and means that you can pass through e.g. `T: AsRef<OsStr>` to
`PathBuf::from` without an intermediate call to `as_ref`.

It also makes a FIXME note for later generalizing the blanket impls for
`AsRef` and `AsMut` to use `Deref`/`DerefMut`, once it is possible to do
so.
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Mar 27, 2015
This commit revises `path` and `os_str` to use blanket impls for `From`
on reference types. This both cuts down on the number of required impls,
and means that you can pass through e.g. `T: AsRef<OsStr>` to
`PathBuf::from` without an intermediate call to `as_ref`.

It also makes a FIXME note for later generalizing the blanket impls for
`AsRef` and `AsMut` to use `Deref`/`DerefMut`, once it is possible to do
so.
@bors bors merged commit e7525cf into rust-lang:master Mar 28, 2015
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.

5 participants