Fix unchecked builds.

This commit is contained in:
Stephen Chung 2021-04-24 18:14:48 +08:00
parent 41d3709db1
commit f81e3d6ff8
3 changed files with 6 additions and 6 deletions

View File

@ -1074,7 +1074,7 @@ impl Engine {
Some(Ok(module_ast)) => { Some(Ok(module_ast)) => {
collect_imports(&module_ast, &mut resolver, &mut imports) collect_imports(&module_ast, &mut resolver, &mut imports)
} }
Some(err @ Err(_)) => return err, Some(err) => return err,
None => (), None => (),
} }

View File

@ -342,7 +342,7 @@ impl ModuleResolver for FileModuleResolver {
ast.set_source(path); ast.set_source(path);
Some(Ok(ast)) Some(Ok(ast))
} }
err @ Err(_) => Some(err), err => Some(err),
} }
} }
} }

View File

@ -5,7 +5,7 @@ use std::ops::Range;
use std::prelude::v1::*; use std::prelude::v1::*;
#[cfg(not(feature = "unchecked"))] #[cfg(not(feature = "unchecked"))]
use num_traits::{CheckedAdd, CheckedSub}; use num_traits::{CheckedAdd as Add, CheckedSub as Sub};
#[cfg(feature = "unchecked")] #[cfg(feature = "unchecked")]
use std::ops::{Add, Sub}; use std::ops::{Add, Sub};
@ -14,11 +14,11 @@ use std::ops::{Add, Sub};
#[derive(Debug, Clone, Copy, Hash, Eq, PartialEq)] #[derive(Debug, Clone, Copy, Hash, Eq, PartialEq)]
struct StepRange<T>(T, T, T) struct StepRange<T>(T, T, T)
where where
T: Variant + Copy + PartialOrd + CheckedAdd<Output = T> + CheckedSub<Output = T>; T: Variant + Copy + PartialOrd + Add<Output = T> + Sub<Output = T>;
impl<T> StepRange<T> impl<T> StepRange<T>
where where
T: Variant + Copy + PartialOrd + CheckedAdd<Output = T> + CheckedSub<Output = T>, T: Variant + Copy + PartialOrd + Add<Output = T> + Sub<Output = T>,
{ {
pub fn new(from: T, to: T, step: T) -> Result<Self, Box<EvalAltResult>> { pub fn new(from: T, to: T, step: T) -> Result<Self, Box<EvalAltResult>> {
#[cfg(not(feature = "unchecked"))] #[cfg(not(feature = "unchecked"))]
@ -43,7 +43,7 @@ where
impl<T> Iterator for StepRange<T> impl<T> Iterator for StepRange<T>
where where
T: Variant + Copy + PartialOrd + CheckedAdd<Output = T> + CheckedSub<Output = T>, T: Variant + Copy + PartialOrd + Add<Output = T> + Sub<Output = T>,
{ {
type Item = T; type Item = T;