make clippy happy (#291)

This commit is contained in:
Mike Voronov
2022-08-10 12:27:06 +03:00
committed by GitHub
parent e884210d35
commit 0d9390d333
13 changed files with 31 additions and 26 deletions

View File

@ -68,6 +68,7 @@ impl AVMRunner {
Ok(avm)
}
#[allow(clippy::too_many_arguments)]
#[tracing::instrument(skip_all)]
pub fn call(
&mut self,
@ -106,6 +107,7 @@ impl AVMRunner {
Ok(outcome)
}
#[allow(clippy::too_many_arguments)]
#[tracing::instrument(skip_all)]
pub fn call_tracing(
&mut self,
@ -170,6 +172,7 @@ impl AVMRunner {
}
}
#[allow(clippy::too_many_arguments)]
#[tracing::instrument(skip(air, prev_data, data, call_results))]
fn prepare_args(
air: impl Into<String>,

View File

@ -25,7 +25,7 @@ use air_lambda_ast::LambdaAST;
use serde::Deserialize;
use serde::Serialize;
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub enum CallInstrValue<'i> {
InitPeerId,
Literal(&'i str),
@ -34,7 +34,7 @@ pub enum CallInstrValue<'i> {
/// Triplet represents a location of the executable code in the network.
/// It is build from `PeerPart` and `FunctionPart` of a `Call` instruction.
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub struct Triplet<'i> {
#[serde(borrow)]
pub peer_pk: CallInstrValue<'i>,
@ -58,7 +58,7 @@ pub enum Value<'i> {
Variable(VariableWithLambda<'i>),
}
#[derive(Serialize, Debug, PartialEq, Clone)]
#[derive(Serialize, Debug, PartialEq, Eq, Clone)]
pub enum CallOutputValue<'i> {
Variable(Variable<'i>),
None,
@ -83,7 +83,7 @@ pub enum Number {
Float(f64),
}
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub enum FoldScalarIterable<'i> {
#[serde(borrow)]
Scalar(ScalarWithLambda<'i>),

View File

@ -86,7 +86,7 @@ pub struct MisMatch<'i> {
/// (fail 1337 "error message")
/// (fail %last_error%)
#[derive(Serialize, Debug, PartialEq)]
#[derive(Serialize, Debug, PartialEq, Eq)]
pub enum Fail<'i> {
Scalar(ScalarWithLambda<'i>),
Literal {
@ -118,7 +118,7 @@ pub struct FoldStream<'i> {
}
/// (fold stream_iterable iterator instruction)
#[derive(Serialize, Debug, PartialEq)]
#[derive(Serialize, Debug, PartialEq, Eq)]
pub struct Next<'i> {
pub iterator: Scalar<'i>,
}
@ -132,5 +132,5 @@ pub struct New<'i> {
}
/// (null)
#[derive(Serialize, Debug, PartialEq)]
#[derive(Serialize, Debug, PartialEq, Eq)]
pub struct Null;

View File

@ -23,14 +23,14 @@ use serde::Deserialize;
use serde::Serialize;
/// A scalar value without lambda.
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub struct Scalar<'i> {
pub name: &'i str,
pub position: usize,
}
/// A scalar value with possible lambda expression.
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub struct ScalarWithLambda<'i> {
pub name: &'i str,
#[serde(borrow)]
@ -39,14 +39,14 @@ pub struct ScalarWithLambda<'i> {
}
/// A stream without lambda.
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub struct Stream<'i> {
pub name: &'i str,
pub position: usize,
}
/// A stream with possible lambda expression.
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub struct StreamWithLambda<'i> {
pub name: &'i str,
#[serde(borrow)]
@ -55,7 +55,7 @@ pub struct StreamWithLambda<'i> {
}
/// A variable that could be either scalar or stream without lambda.
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub enum Variable<'i> {
#[serde(borrow)]
Scalar(Scalar<'i>),
@ -64,7 +64,7 @@ pub enum Variable<'i> {
}
/// A variable that could be either scalar or stream with possible lambda expression.
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub enum VariableWithLambda<'i> {
#[serde(borrow)]
Scalar(ScalarWithLambda<'i>),

View File

@ -17,7 +17,7 @@
#[macro_export]
macro_rules! make_user_error(
($error_type:ident, $start_pos: ident, $token:expr, $end_pos: ident) => { {
let error = crate::parser::ParserError::$error_type(crate::parser::Span::new($start_pos, $end_pos));
let error = $crate::parser::ParserError::$error_type($crate::parser::Span::new($start_pos, $end_pos));
let error = lalrpop_util::ParseError::User { error };
let dropped_tokens = vec![($start_pos, $token, $end_pos)];

View File

@ -78,26 +78,24 @@ use fluence_it_types::ne_vec::NEVec;
fn try_as_record(ivalue: IValue) -> Result<NEVec<IValue>, String> {
match ivalue {
IValue::Record(record_values) => Ok(record_values),
v => {
return Err(format!(
v => Err(format!(
"expected record for InterpreterOutcome, got {:?}",
v
))
}
)),
}
}
fn try_as_i64(ivalue: IValue, field_name: &str) -> Result<i64, String> {
match ivalue {
IValue::S64(value) => Ok(value),
v => return Err(format!("expected an i64 for {}, got {:?}", field_name, v)),
v => Err(format!("expected an i64 for {}, got {:?}", field_name, v)),
}
}
fn try_as_string(ivalue: IValue, field_name: &str) -> Result<String, String> {
match ivalue {
IValue::String(value) => Ok(value),
v => return Err(format!("expected a string for {}, got {:?}", field_name, v)),
v => Err(format!("expected a string for {}, got {:?}", field_name, v)),
}
}

View File

@ -22,7 +22,7 @@ use serde::Serialize;
pub type LambdaAST<'input> = NonEmpty<ValueAccessor<'input>>;
#[derive(Debug, PartialEq, Clone, Copy, Serialize, Deserialize)]
#[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize)]
pub enum ValueAccessor<'input> {
// (.)?[$idx]
ArrayAccess { idx: u32 },

View File

@ -28,6 +28,7 @@ use std::collections::HashSet;
pub trait AirRunner {
fn new(current_call_id: impl Into<String>) -> Self;
#[allow(clippy::too_many_arguments)]
fn call(
&mut self,
air: impl Into<String>,

View File

@ -26,7 +26,7 @@ use air_interpreter_data::InterpreterData;
use std::collections::HashMap;
/// Contains all necessary information about data.
#[derive(Debug, Default, PartialEq)]
#[derive(Debug, Default, PartialEq, Eq)]
pub struct MergeCtx {
pub slider: TraceSlider,
pub streams: GlobalStreamGens,

View File

@ -48,7 +48,7 @@ pub trait DataStore {
) -> Result<(), Self::Error>;
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct AnomalyData<'data> {
#[serde(borrow)]
pub air_script: Cow<'data, str>,

View File

@ -18,6 +18,7 @@ use avm_server::avm_runner::*;
use avm_server::CallResults;
pub(crate) trait AirRunner {
#[allow(clippy::too_many_arguments)]
fn call_tracing(
&mut self,
air: String,

View File

@ -48,6 +48,7 @@ pub(crate) fn stats(mut args: Args) -> anyhow::Result<()> {
let mut stats = self::report::StatsReport::new();
#[allow(clippy::significant_drop_in_scrutinee)]
for rec in read_logs(stdin) {
let rec = rec?;

View File

@ -27,7 +27,8 @@ pub(crate) fn parse_tracing_duration(input: &str) -> Result<Duration, anyhow::Er
}
}
}
return Err(anyhow::anyhow!("malformed duration {:?}", input));
Err(anyhow::anyhow!("malformed duration {:?}", input))
}
pub(crate) fn unix_timestamp_now() -> u64 {