From 1d765f3e80f32ba1d846a0c05c3896fca4843f4c Mon Sep 17 00:00:00 2001 From: Philipp Eder Date: Mon, 13 May 2024 17:09:56 +0200 Subject: [PATCH] Clippy complex type warning --- rust/Cargo.lock | 8 ++++---- rust/nasl-builtin-utils/src/context.rs | 3 +-- rust/nasl-interpreter/src/fork_interpreter.rs | 4 +++- rust/storage/src/retrieve.rs | 4 ++++ 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 148a6089e..3fe8911d6 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -3312,18 +3312,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.59" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa" +checksum = "579e9083ca58dd9dcf91a9923bb9054071b9ebbd800b342194c9feb0ee89fc18" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.59" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66" +checksum = "e2470041c06ec3ac1ab38d0356a6119054dedaea53e12fbefc0de730a1c08524" dependencies = [ "proc-macro2", "quote", diff --git a/rust/nasl-builtin-utils/src/context.rs b/rust/nasl-builtin-utils/src/context.rs index c317487a6..604313a3d 100644 --- a/rust/nasl-builtin-utils/src/context.rs +++ b/rust/nasl-builtin-utils/src/context.rs @@ -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; @@ -283,7 +283,6 @@ impl Default for Register { } use std::{ collections::HashMap, - time::{SystemTime, UNIX_EPOCH}, }; type Named = HashMap; diff --git a/rust/nasl-interpreter/src/fork_interpreter.rs b/rust/nasl-interpreter/src/fork_interpreter.rs index e79b4e322..2494a4e5b 100644 --- a/rust/nasl-interpreter/src/fork_interpreter.rs +++ b/rust/nasl-interpreter/src/fork_interpreter.rs @@ -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; /// 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, /// call back function for Statements before they get interpret - pub statemet_cb: Option>, + pub statemet_cb: Option, } impl<'a, 'b, K> CodeInterpreter<'a, 'b, K> diff --git a/rust/storage/src/retrieve.rs b/rust/storage/src/retrieve.rs index 563551253..df991c086 100644 --- a/rust/storage/src/retrieve.rs +++ b/rust/storage/src/retrieve.rs @@ -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 { /// Gets Fields find by key and scope. This is to get all instances. fn retrieve( @@ -94,6 +96,8 @@ pub trait Retriever { ) -> Result>, StorageError>; /// Gets Fields find by field and scope. + /// + /// This is used to filter results. fn retrieve_by_field( &self, field: Field,