diff --git a/compiler/gen/src/llvm/build.rs b/compiler/gen/src/llvm/build.rs index 1a7aa72d37..6494512630 100644 --- a/compiler/gen/src/llvm/build.rs +++ b/compiler/gen/src/llvm/build.rs @@ -90,9 +90,9 @@ pub enum OptLevel { Optimize, } -impl Into for OptLevel { - fn into(self) -> OptimizationLevel { - match self { +impl From for OptimizationLevel { + fn from(level: OptLevel) -> Self { + match level { OptLevel::Normal => OptimizationLevel::None, OptLevel::Optimize => OptimizationLevel::Aggressive, } diff --git a/compiler/gen/src/run_roc.rs b/compiler/gen/src/run_roc.rs index f5e75c4b1a..ec25e4cae3 100644 --- a/compiler/gen/src/run_roc.rs +++ b/compiler/gen/src/run_roc.rs @@ -8,9 +8,9 @@ pub enum RocCallResult { Failure(*mut c_char), } -impl Into> for RocCallResult { - fn into(self) -> Result { - match self { +impl From> for Result { + fn from(call_result: RocCallResult) -> Self { + match call_result { Success(value) => Ok(value), Failure(failure) => Err({ let raw = unsafe { CString::from_raw(failure) }; diff --git a/compiler/module/src/ident.rs b/compiler/module/src/ident.rs index 48cacc84fe..16e38aabb6 100644 --- a/compiler/module/src/ident.rs +++ b/compiler/module/src/ident.rs @@ -117,21 +117,21 @@ impl From for ModuleName { } } -impl Into for ModuleName { - fn into(self) -> InlinableString { - self.0 +impl From for InlinableString { + fn from(name: ModuleName) -> Self { + name.0 } } -impl<'a> Into<&'a InlinableString> for &'a ModuleName { - fn into(self) -> &'a InlinableString { - &self.0 +impl<'a> From<&'a ModuleName> for &'a InlinableString { + fn from(name: &'a ModuleName) -> Self { + &name.0 } } -impl<'a> Into> for ModuleName { - fn into(self) -> Box { - self.0.to_string().into() +impl From for Box { + fn from(name: ModuleName) -> Self { + name.0.to_string().into() } } @@ -197,9 +197,9 @@ impl<'a> From for Lowercase { } } -impl Into for Lowercase { - fn into(self) -> InlinableString { - self.0 +impl From for InlinableString { + fn from(lowercase: Lowercase) -> Self { + lowercase.0 } } @@ -234,21 +234,21 @@ impl From for Ident { } } -impl Into for Ident { - fn into(self) -> InlinableString { - self.0 +impl From for InlinableString { + fn from(ident: Ident) -> Self { + ident.0 } } -impl<'a> Into<&'a InlinableString> for &'a Ident { - fn into(self) -> &'a InlinableString { - &self.0 +impl<'a> From<&'a Ident> for &'a InlinableString { + fn from(ident: &'a Ident) -> Self { + &ident.0 } } -impl<'a> Into> for Ident { - fn into(self) -> Box { - self.0.to_string().into() +impl From for Box { + fn from(ident: Ident) -> Self { + ident.0.to_string().into() } } diff --git a/compiler/parse/src/header.rs b/compiler/parse/src/header.rs index 5442509877..f8bb29630b 100644 --- a/compiler/parse/src/header.rs +++ b/compiler/parse/src/header.rs @@ -42,15 +42,15 @@ pub enum PackageOrPath<'a> { #[derive(Clone, PartialEq, Eq, Debug, Hash)] pub struct ModuleName<'a>(&'a str); -impl<'a> Into<&'a str> for ModuleName<'a> { - fn into(self) -> &'a str { - self.0 +impl<'a> From> for &'a str { + fn from(name: ModuleName<'a>) -> Self { + name.0 } } -impl<'a> Into for ModuleName<'a> { - fn into(self) -> InlinableString { - self.0.into() +impl<'a> From> for InlinableString { + fn from(name: ModuleName<'a>) -> InlinableString { + name.0.into() } } diff --git a/compiler/types/src/subs.rs b/compiler/types/src/subs.rs index 27f2e10c49..e69523e33e 100644 --- a/compiler/types/src/subs.rs +++ b/compiler/types/src/subs.rs @@ -93,9 +93,9 @@ impl VarStore { } } -impl Into for VarStore { - fn into(self) -> Variable { - Variable(self.next) +impl From for Variable { + fn from(store: VarStore) -> Self { + Variable(store.next) } } @@ -139,9 +139,9 @@ impl fmt::Debug for OptVariable { } } -impl Into> for OptVariable { - fn into(self) -> Option { - self.into_variable() +impl From for Option { + fn from(opt_var: OptVariable) -> Self { + opt_var.into_variable() } } @@ -180,9 +180,9 @@ impl Variable { } } -impl Into for Variable { - fn into(self) -> OptVariable { - OptVariable(self.0) +impl From for OptVariable { + fn from(var: Variable) -> Self { + OptVariable(var.0) } } @@ -483,9 +483,9 @@ impl fmt::Debug for Rank { } } -impl Into for Rank { - fn into(self) -> usize { - self.0 +impl From for usize { + fn from(rank: Rank) -> Self { + rank.0 } } diff --git a/roc_std/src/lib.rs b/roc_std/src/lib.rs index f6a3e38b42..57a6c6e624 100644 --- a/roc_std/src/lib.rs +++ b/roc_std/src/lib.rs @@ -502,11 +502,11 @@ pub enum RocCallResult { Failure(*mut c_char), } -impl Into> for RocCallResult { - fn into(self) -> Result { +impl From> for Result { + fn from(call_result: RocCallResult) -> Self { use RocCallResult::*; - match self { + match call_result { Success(value) => Ok(value), Failure(failure) => Err({ let msg = unsafe { @@ -529,11 +529,11 @@ impl Into> for RocCallResult { } } -impl<'a, T: Sized + Copy> Into> for &'a RocCallResult { - fn into(self) -> Result { +impl<'a, T: Sized + Copy> From<&'a RocCallResult> for Result { + fn from(call_result: &'a RocCallResult) -> Self { use RocCallResult::*; - match self { + match call_result { Success(value) => Ok(*value), Failure(failure) => Err({ let msg = unsafe {