mirror of
https://github.com/fluencelabs/wasmer
synced 2025-07-02 18:11:34 +00:00
feat(interface-types) Fix clippy errors and warnings.
This commit is contained in:
@ -415,7 +415,6 @@ fn interfaces<'input, E: ParseError<&'input [u8]>>(
|
||||
/// interpreter::Instruction,
|
||||
/// };
|
||||
///
|
||||
/// # fn main() {
|
||||
/// let input = &[
|
||||
/// 0x00, // type section
|
||||
/// 0x01, // 1 type
|
||||
@ -477,7 +476,6 @@ fn interfaces<'input, E: ParseError<&'input [u8]>>(
|
||||
/// ));
|
||||
///
|
||||
/// assert_eq!(parse::<()>(input), output);
|
||||
/// # }
|
||||
/// ```
|
||||
pub fn parse<'input, E: ParseError<&'input [u8]>>(
|
||||
bytes: &'input [u8],
|
||||
|
@ -119,10 +119,6 @@ impl Parse<'_> for InterfaceType {
|
||||
} else if lookahead.peek::<keyword::string>() {
|
||||
parser.parse::<keyword::string>()?;
|
||||
|
||||
Ok(InterfaceType::String)
|
||||
} else if lookahead.peek::<keyword::string>() {
|
||||
parser.parse::<keyword::string>()?;
|
||||
|
||||
Ok(InterfaceType::String)
|
||||
} else if lookahead.peek::<keyword::anyref>() {
|
||||
parser.parse::<keyword::anyref>()?;
|
||||
@ -143,6 +139,7 @@ impl Parse<'_> for InterfaceType {
|
||||
}
|
||||
|
||||
impl<'a> Parse<'a> for Instruction<'a> {
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn parse(parser: Parser<'a>) -> Result<Self> {
|
||||
let mut lookahead = parser.lookahead1();
|
||||
|
||||
@ -588,7 +585,6 @@ impl<'a> Parse<'a> for Interfaces<'a> {
|
||||
/// interpreter::Instruction,
|
||||
/// };
|
||||
///
|
||||
/// # fn main() {
|
||||
/// let input = Buffer::new(
|
||||
/// r#"(@interface type (func (param i32) (result s8)))
|
||||
///
|
||||
@ -626,7 +622,6 @@ impl<'a> Parse<'a> for Interfaces<'a> {
|
||||
/// };
|
||||
///
|
||||
/// assert_eq!(parse(&input).unwrap(), output);
|
||||
/// # }
|
||||
/// ```
|
||||
pub fn parse<'input>(input: &'input Buffer) -> Result<Interfaces<'input>> {
|
||||
parser::parse::<Interfaces>(&input)
|
||||
|
@ -9,7 +9,6 @@
|
||||
//! interpreter::Instruction,
|
||||
//! };
|
||||
//!
|
||||
//! # fn main() {
|
||||
//! let input: String = (&Interfaces {
|
||||
//! types: vec![Type {
|
||||
//! inputs: vec![InterfaceType::I32],
|
||||
@ -53,7 +52,6 @@
|
||||
//! (@interface implement (func 0) (func 1))"#;
|
||||
//!
|
||||
//! assert_eq!(input, output);
|
||||
//! # }
|
||||
//! ```
|
||||
|
||||
use crate::{ast::*, interpreter::Instruction};
|
||||
|
@ -66,7 +66,6 @@ pub(crate) type ExecutableInstruction<Instance, Export, LocalImport, Memory, Mem
|
||||
/// Instruction, Interpreter,
|
||||
/// };
|
||||
///
|
||||
/// # fn main() {
|
||||
/// // 1. Creates an interpreter from a set of instructions. They will
|
||||
/// // be transformed into executable instructions.
|
||||
/// let interpreter: Interpreter<Instance, Export, LocalImport, Memory, MemoryView> = (&vec![
|
||||
@ -116,7 +115,6 @@ pub(crate) type ExecutableInstruction<Instance, Export, LocalImport, Memory, Mem
|
||||
///
|
||||
/// // 5. Read the stack to get the result.
|
||||
/// assert_eq!(stack.as_slice(), &[InterfaceValue::I32(7)]);
|
||||
/// # }
|
||||
/// ```
|
||||
pub struct Interpreter<Instance, Export, LocalImport, Memory, MemoryView>
|
||||
where
|
||||
|
Reference in New Issue
Block a user