Skip to content

Commit

Permalink
Clippy complex type warning
Browse files Browse the repository at this point in the history
  • Loading branch information
nichtsfrei committed May 15, 2024
1 parent 295f2b6 commit 1d765f3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
8 changes: 4 additions & 4 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions rust/nasl-builtin-utils/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! Defines the context used within the interpreter and utilized by the builtin functions

use nasl_syntax::{logger::NaslLogger, Loader, NaslValue, Statement};
use storage::{types::Primitive, Dispatcher, Field, Kb, Retriever};
use storage::{Dispatcher, Retriever};

use crate::lookup_keys::FC_ANON_ARGS;

Expand Down Expand Up @@ -283,7 +283,6 @@ impl Default for Register {
}
use std::{
collections::HashMap,
time::{SystemTime, UNIX_EPOCH},
};
type Named = HashMap<String, ContextType>;

Expand Down
4 changes: 3 additions & 1 deletion rust/nasl-interpreter/src/fork_interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ use nasl_syntax::Statement;

use crate::interpreter::InterpretResult;

/// To allow closures we use a heap stored statement consumer
pub type StatementConsumer = Box<dyn Fn(&Statement)>;
/// Uses given code to return results based on that.
pub struct CodeInterpreter<'a, 'b, K> {
lexer: nasl_syntax::Lexer<'b>,
interpreter: crate::interpreter::Interpreter<'a, K>,
statement: Option<Statement>,
/// call back function for Statements before they get interpret
pub statemet_cb: Option<Box<dyn Fn(&Statement)>>,
pub statemet_cb: Option<StatementConsumer>,
}

impl<'a, 'b, K> CodeInterpreter<'a, 'b, K>
Expand Down
4 changes: 4 additions & 0 deletions rust/storage/src/retrieve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ impl Retrieve {
}

/// Retrieves fields based on a key and scope.
// TODO: remove K infavor of a enum, as a user of that interface it is very hard to differentiate
// when to use an OID and when not. A better solution would be to use enums.
pub trait Retriever<K> {
/// Gets Fields find by key and scope. This is to get all instances.
fn retrieve(
Expand All @@ -94,6 +96,8 @@ pub trait Retriever<K> {
) -> Result<Box<dyn Iterator<Item = Field>>, StorageError>;

/// Gets Fields find by field and scope.
///
/// This is used to filter results.
fn retrieve_by_field(
&self,
field: Field,
Expand Down

0 comments on commit 1d765f3

Please sign in to comment.