Skip to content

Commit 0041761

Browse files
philrhcPhil Cummins
andauthored
nightly compiler/lint fixes (#129)
* test * trigger test workflow * remove lint from workflow * lint/compiler fixes * re-adds readme --------- Co-authored-by: Phil Cummins <philip.cummins@bsc.es>
1 parent 528a3a0 commit 0041761

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

src/stubwasi.rs

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ use wasmparser::{FuncType, Parser, Payload, TypeRef};
1010

1111
use crate::Library;
1212

13-
pub fn link_stub_modules(
14-
libraries: Vec<Library>,
15-
) -> Result<Option<(Vec<u8>, impl Fn(u32) -> u32)>, Error> {
13+
type LinkedStubModules = Option<(Vec<u8>, Box<dyn Fn(u32) -> u32>)>;
14+
15+
pub fn link_stub_modules(libraries: Vec<Library>) -> Result<LinkedStubModules, Error> {
1616
let mut wasi_imports = HashMap::new();
1717
let mut linker = wit_component::Linker::default()
1818
.validate(true)
@@ -47,18 +47,21 @@ pub fn link_stub_modules(
4747
let new_adapter_count = u32::try_from(wasi_imports.len())?;
4848
assert!(new_adapter_count >= old_adapter_count);
4949

50-
Ok(Some((component, move |index: u32| {
51-
if index == 0 {
52-
// `main` module
53-
0
54-
} else if index <= new_adapter_count {
55-
// adapter module
56-
old_adapter_count
57-
} else {
58-
// one of the other kinds of module
59-
index + old_adapter_count - new_adapter_count
60-
}
61-
})))
50+
Ok(Some((
51+
component,
52+
Box::new(move |index: u32| {
53+
if index == 0 {
54+
// `main` module
55+
0
56+
} else if index <= new_adapter_count {
57+
// adapter module
58+
old_adapter_count
59+
} else {
60+
// one of the other kinds of module
61+
index + old_adapter_count - new_adapter_count
62+
}
63+
}),
64+
)))
6265
}
6366

6467
fn add_wasi_imports<'a>(

src/summary.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ pub struct MyFunction<'a> {
8888
pub wit_kind: wit_parser::FunctionKind,
8989
}
9090

91-
impl<'a> MyFunction<'a> {
91+
impl MyFunction<'_> {
9292
fn key(&self) -> WorldKey {
9393
if let Some(interface) = self.interface.as_ref() {
9494
WorldKey::Interface(interface.id)

src/test/tests.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(non_local_definitions)]
2+
13
use {
24
super::{Ctx, Tester, SEED},
35
anyhow::{anyhow, Error, Result},

0 commit comments

Comments
 (0)