Remove explicit S type parameters (#5275)

* Remove explicit `S` type parameters

This commit removes the explicit `S` type parameter on `Func::typed` and
`Instance::get_typed_func`. Historical versions of Rust required that
this be a type parameter but recent rustcs support a mixture of explicit
type parameters and `impl Trait`. This removes, at callsites, a
superfluous `, _` argument which otherwise never needs specification.

* Fix mdbook examples
This commit is contained in:
Alex Crichton
2022-11-15 23:04:26 -06:00
committed by GitHub
parent 8426904129
commit b0939f6626
50 changed files with 223 additions and 238 deletions

View File

@@ -43,7 +43,7 @@ fn forward_call_works() -> Result<()> {
)?;
let i = Instance::new(&mut store, &module, &[])?;
let foo = i.get_typed_func::<(), i32, _>(&mut store, "foo")?;
let foo = i.get_typed_func::<(), i32>(&mut store, "foo")?;
assert_eq!(foo.call(&mut store, ())?, 4);
Ok(())
}
@@ -64,7 +64,7 @@ fn backwards_call_works() -> Result<()> {
)?;
let i = Instance::new(&mut store, &module, &[])?;
let foo = i.get_typed_func::<(), i32, _>(&mut store, "foo")?;
let foo = i.get_typed_func::<(), i32>(&mut store, "foo")?;
assert_eq!(foo.call(&mut store, ())?, 4);
Ok(())
}
@@ -108,7 +108,7 @@ fn test_many_call_module(mut store: Store<()>) -> Result<()> {
for i in 0..N {
let name = i.to_string();
let func = instance.get_typed_func::<(), (i32, i32), _>(&mut store, &name)?;
let func = instance.get_typed_func::<(), (i32, i32)>(&mut store, &name)?;
let (a, b) = func.call(&mut store, ())?;
assert_eq!(a, i + 1);
assert_eq!(b, i + 2);