Replace a bunch of Into impls with Froms

This commit is contained in:
Richard Feldman 2021-03-26 08:39:01 -04:00
parent 7d004c48b1
commit eadb28b95d
6 changed files with 51 additions and 51 deletions

View file

@ -90,9 +90,9 @@ pub enum OptLevel {
Optimize,
}
impl Into<OptimizationLevel> for OptLevel {
fn into(self) -> OptimizationLevel {
match self {
impl From<OptLevel> for OptimizationLevel {
fn from(level: OptLevel) -> Self {
match level {
OptLevel::Normal => OptimizationLevel::None,
OptLevel::Optimize => OptimizationLevel::Aggressive,
}

View file

@ -8,9 +8,9 @@ pub enum RocCallResult<T> {
Failure(*mut c_char),
}
impl<T: Sized> Into<Result<T, String>> for RocCallResult<T> {
fn into(self) -> Result<T, String> {
match self {
impl<T: Sized> From<RocCallResult<T>> for Result<T, String> {
fn from(call_result: RocCallResult<T>) -> Self {
match call_result {
Success(value) => Ok(value),
Failure(failure) => Err({
let raw = unsafe { CString::from_raw(failure) };