Rollup merge of #134949 - compiler-errors:froms, r=jieyouxu
Convert some `Into` impls into `From` impls From the [`From`](https://doc.rust-lang.org/std/convert/trait.From.html) docs: > One should always prefer implementing `From` over [`Into`](https://doc.rust-lang.org/std/convert/trait.Into.html) because implementing `From` automatically provides one with an implementation of [`Into`](https://doc.rust-lang.org/std/convert/trait.Into.html) thanks to the blanket implementation in the standard library. > > Only implement [`Into`](https://doc.rust-lang.org/std/convert/trait.Into.html) when targeting a version prior to Rust 1.41 and converting to a type outside the current crate. `From` was not able to do these types of conversions in earlier versions because of Rust’s orphaning rules. See [Into](https://doc.rust-lang.org/std/convert/trait.Into.html) for more details. Some of these impls are likely from before 1.41, and then some others were probably just mistakes. Building nightly rust is definitely not supported on 1.41, so let's modernize these impls :D
This commit is contained in:
commit
2491edab30
9 changed files with 45 additions and 45 deletions
|
@ -45,12 +45,12 @@ pub enum TypeAnnotationNeeded {
|
|||
E0284,
|
||||
}
|
||||
|
||||
impl Into<ErrCode> for TypeAnnotationNeeded {
|
||||
fn into(self) -> ErrCode {
|
||||
match self {
|
||||
Self::E0282 => E0282,
|
||||
Self::E0283 => E0283,
|
||||
Self::E0284 => E0284,
|
||||
impl From<TypeAnnotationNeeded> for ErrCode {
|
||||
fn from(val: TypeAnnotationNeeded) -> Self {
|
||||
match val {
|
||||
TypeAnnotationNeeded::E0282 => E0282,
|
||||
TypeAnnotationNeeded::E0283 => E0283,
|
||||
TypeAnnotationNeeded::E0284 => E0284,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue