mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 15:21:12 +00:00
Replace a bunch of Into impls with Froms
This commit is contained in:
parent
7d004c48b1
commit
eadb28b95d
6 changed files with 51 additions and 51 deletions
|
@ -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,
|
||||
}
|
||||
|
|
|
@ -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) };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue