Use turbofish for impl Trait.
This commit is contained in:
@@ -29,13 +29,13 @@ fn test_call_fn() -> Result<(), Box<EvalAltResult>> {
|
||||
",
|
||||
)?;
|
||||
|
||||
let r: INT = engine.call_fn(&mut scope, &ast, "hello", (42 as INT, 123 as INT))?;
|
||||
let r = engine.call_fn::<INT>(&mut scope, &ast, "hello", (42 as INT, 123 as INT))?;
|
||||
assert_eq!(r, 165);
|
||||
|
||||
let r: INT = engine.call_fn(&mut scope, &ast, "hello", (123 as INT,))?;
|
||||
let r = engine.call_fn::<INT>(&mut scope, &ast, "hello", (123 as INT,))?;
|
||||
assert_eq!(r, 5166);
|
||||
|
||||
let r: INT = engine.call_fn(&mut scope, &ast, "hello", ())?;
|
||||
let r = engine.call_fn::<INT>(&mut scope, &ast, "hello", ())?;
|
||||
assert_eq!(r, 42);
|
||||
|
||||
assert_eq!(
|
||||
@@ -45,7 +45,7 @@ fn test_call_fn() -> Result<(), Box<EvalAltResult>> {
|
||||
1
|
||||
);
|
||||
|
||||
let r: INT = engine.call_fn(&mut scope, &ast, "define_var", (2 as INT,))?;
|
||||
let r = engine.call_fn::<INT>(&mut scope, &ast, "define_var", (2 as INT,))?;
|
||||
assert_eq!(r, 42);
|
||||
|
||||
assert!(!scope.contains("bar"));
|
||||
@@ -132,7 +132,7 @@ fn test_call_fn_args() -> Result<(), Box<EvalAltResult>> {
|
||||
",
|
||||
)?;
|
||||
|
||||
let result: String = engine.call_fn(&mut scope, &ast, "hello", options)?;
|
||||
let result = engine.call_fn::<String>(&mut scope, &ast, "hello", options)?;
|
||||
|
||||
assert_eq!(result, "world42");
|
||||
|
||||
@@ -146,12 +146,12 @@ fn test_call_fn_private() -> Result<(), Box<EvalAltResult>> {
|
||||
|
||||
let ast = engine.compile("fn add(x, n) { x + n }")?;
|
||||
|
||||
let r: INT = engine.call_fn(&mut scope, &ast, "add", (40 as INT, 2 as INT))?;
|
||||
let r = engine.call_fn::<INT>(&mut scope, &ast, "add", (40 as INT, 2 as INT))?;
|
||||
assert_eq!(r, 42);
|
||||
|
||||
let ast = engine.compile("private fn add(x, n, ) { x + n }")?;
|
||||
|
||||
let r: INT = engine.call_fn(&mut scope, &ast, "add", (40 as INT, 2 as INT))?;
|
||||
let r = engine.call_fn::<INT>(&mut scope, &ast, "add", (40 as INT, 2 as INT))?;
|
||||
assert_eq!(r, 42);
|
||||
|
||||
Ok(())
|
||||
|
@@ -338,7 +338,7 @@ fn test_closures_shared_obj() -> Result<(), Box<EvalAltResult>> {
|
||||
let res = engine.eval_ast::<Map>(&ast)?;
|
||||
|
||||
// Make closure
|
||||
let f = move |p1: TestStruct, p2: TestStruct| -> Result<(), Box<EvalAltResult>> {
|
||||
let f = move |p1: TestStruct, p2: TestStruct| {
|
||||
let action_ptr = res["action"].clone_cast::<FnPtr>();
|
||||
let name = action_ptr.fn_name();
|
||||
engine.call_fn(&mut Scope::new(), &ast, name, (p1, p2))
|
||||
|
@@ -279,7 +279,7 @@ fn test_module_resolver() -> Result<(), Box<EvalAltResult>> {
|
||||
|
||||
assert!(engine.eval::<INT>(script).is_err());
|
||||
|
||||
let result: INT = engine.call_fn(&mut Scope::new(), &ast, "foo", (2 as INT,))?;
|
||||
let result = engine.call_fn::<INT>(&mut Scope::new(), &ast, "foo", (2 as INT,))?;
|
||||
|
||||
assert_eq!(result, 84);
|
||||
|
||||
@@ -296,7 +296,7 @@ fn test_module_resolver() -> Result<(), Box<EvalAltResult>> {
|
||||
assert_eq!(ast2.resolver().unwrap().len(), len);
|
||||
}
|
||||
|
||||
let result: INT = engine.call_fn(&mut Scope::new(), &ast2, "foo", (2 as INT,))?;
|
||||
let result = engine.call_fn::<INT>(&mut Scope::new(), &ast2, "foo", (2 as INT,))?;
|
||||
|
||||
assert_eq!(result, 84);
|
||||
}
|
||||
|
Reference in New Issue
Block a user