Skip to content

Commit

Permalink
chore: fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
morenol committed Dec 9, 2024
1 parent f38d68d commit 604ddf7
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
16 changes: 8 additions & 8 deletions src/expression_evaluator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl<'a> TupleExpression<'a> {
self.expressions.push(expression)
}
}
impl<'a> Evaluate for TupleExpression<'a> {
impl Evaluate for TupleExpression<'_> {
fn evaluate(&self, values: Context<'_>) -> Result<Value> {
let tuple: ValuesList = self
.expressions
Expand All @@ -72,7 +72,7 @@ impl<'a> DictionaryExpression<'a> {
self.elems.insert(key, value);
}
}
impl<'a> Evaluate for DictionaryExpression<'a> {
impl Evaluate for DictionaryExpression<'_> {
fn evaluate(&self, values: Context<'_>) -> Result<Value> {
let mut dict = ValuesMap::new();
for (key, expression) in self.elems.iter() {
Expand All @@ -92,7 +92,7 @@ impl<'a> FilteredExpression<'a> {
}
}

impl<'a> Evaluate for FilteredExpression<'a> {
impl Evaluate for FilteredExpression<'_> {
fn evaluate(&self, values: Context<'_>) -> Result<Value> {
let result = self.expression.evaluate(values.clone());
let base_value = match result {
Expand Down Expand Up @@ -136,7 +136,7 @@ impl<'a> SubscriptExpression<'a> {
self.subscript_expression.push(subscript);
}
}
impl<'a> Evaluate for SubscriptExpression<'a> {
impl Evaluate for SubscriptExpression<'_> {
fn evaluate(&self, values: Context<'_>) -> Result<Value> {
let mut cur = self.expression.evaluate(values.clone())?;
for idx in &self.subscript_expression {
Expand All @@ -147,7 +147,7 @@ impl<'a> Evaluate for SubscriptExpression<'a> {
Ok(cur)
}
}
impl<'a> Evaluate for Expression<'a> {
impl Evaluate for Expression<'_> {
fn evaluate(&self, values: Context<'_>) -> Result<Value> {
let result = match &self {
Expression::Constant(value) => value.clone(),
Expand Down Expand Up @@ -179,7 +179,7 @@ pub struct FullExpressionEvaluator<'a> {
expression: Option<Expression<'a>>,
}

impl<'a> Render for FullExpressionEvaluator<'a> {
impl Render for FullExpressionEvaluator<'_> {
fn render(&self, out: &mut dyn Write, params: Context<'_>) -> Result<()> {
let value = self.evaluate(params)?;
if let Err(err) = out.write(value.to_string().as_bytes()) {
Expand All @@ -196,7 +196,7 @@ impl<'a> FullExpressionEvaluator<'a> {
}
}

impl<'a> Evaluate for FullExpressionEvaluator<'a> {
impl Evaluate for FullExpressionEvaluator<'_> {
fn evaluate(&self, values: Context<'_>) -> Result<Value> {
let result = match &self.expression {
Some(expression) => expression.evaluate(values)?,
Expand All @@ -212,7 +212,7 @@ pub struct CallParams<'a> {
pub pos_params: Vec<FullExpressionEvaluator<'a>>,
}

impl<'a> CallParams<'a> {
impl CallParams<'_> {
pub fn parse<'b>(
&self,
param_names: Vec<&'b str>,
Expand Down
2 changes: 1 addition & 1 deletion src/expression_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use logos::{Lexer, Logos};
pub struct ExpressionParser {}

impl ExpressionParser {
pub fn parse<'a>(text: &'a str) -> Result<ExpressionRenderer<'_>> {
pub fn parse<'a>(text: &'a str) -> Result<ExpressionRenderer<'a>> {
let lexer: Lexer<'_, Token<'a>> = Token::lexer(text);
let mut lexer = PeekableLexer::new(lexer);

Expand Down
10 changes: 5 additions & 5 deletions src/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ impl<'a> ComposedRenderer<'a> {
}
}

impl<'a> Default for ComposedRenderer<'a> {
impl Default for ComposedRenderer<'_> {
fn default() -> Self {
Self::new()
}
}

impl<'a> Render for ComposedRenderer<'a> {
impl Render for ComposedRenderer<'_> {
fn render(&self, out: &mut dyn Write, params: Context<'_>) -> Result<()> {
for r in self.renderers.read().unwrap().iter() {
r.render(out, params.clone())?;
Expand All @@ -39,7 +39,7 @@ impl<'a> Render for ComposedRenderer<'a> {
}
}

impl<'a> fmt::Debug for ComposedRenderer<'a> {
impl fmt::Debug for ComposedRenderer<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "ComposedRenderer")
}
Expand All @@ -61,7 +61,7 @@ impl<'a> RawTextRenderer<'a> {
}
}

impl<'a> Render for RawTextRenderer<'a> {
impl Render for RawTextRenderer<'_> {
fn render(&self, out: &mut dyn Write, _params: Context<'_>) -> Result<()> {
if let Err(err) = out.write(self.content.as_bytes()) {
Err(Error::Io(err))
Expand All @@ -75,7 +75,7 @@ pub struct ExpressionRenderer<'a> {
expression: FullExpressionEvaluator<'a>,
}

impl<'a> Render for ExpressionRenderer<'a> {
impl Render for ExpressionRenderer<'_> {
fn render(&self, out: &mut dyn Write, params: Context<'_>) -> Result<()> {
self.expression.render(out, params)
}
Expand Down
12 changes: 6 additions & 6 deletions src/statement/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl<'a> IfStatement<'a> {
self.else_branches.push(branch);
}
}
impl<'a> Render for IfStatement<'a> {
impl Render for IfStatement<'_> {
fn render(&self, out: &mut dyn Write, params: Context<'_>) -> Result<()> {
let value = self.expression.evaluate(params.clone())?;
if let Value::Boolean(true) = value {
Expand Down Expand Up @@ -77,7 +77,7 @@ impl<'a> ElseStatement<'a> {
}
}
}
impl<'a> Render for ElseStatement<'a> {
impl Render for ElseStatement<'_> {
fn render(&self, out: &mut dyn Write, params: Context<'_>) -> Result<()> {
self.body.as_ref().unwrap().render(out, params)
}
Expand All @@ -98,7 +98,7 @@ impl<'a> WithStatement<'a> {
self.body = Some(with_body);
}
}
impl<'a> Render for WithStatement<'a> {
impl Render for WithStatement<'_> {
fn render(&self, out: &mut dyn Write, params: Context<'_>) -> Result<()> {
let mut inner_values = params.clone();
let scope = inner_values.enter_scope();
Expand Down Expand Up @@ -166,7 +166,7 @@ impl<'a> ForStatement<'a> {
Ok(())
}
}
impl<'a> Render for ForStatement<'a> {
impl Render for ForStatement<'_> {
fn render(&self, out: &mut dyn Write, params: Context<'_>) -> Result<()> {
let loop_value = self.value.evaluate(params.clone())?;
self.render_loop(loop_value, out, params, 0)?;
Expand All @@ -192,7 +192,7 @@ impl<'a> IncludeStatement<'a> {
}
}
}
impl<'a> Render for IncludeStatement<'a> {
impl Render for IncludeStatement<'_> {
fn render(&self, out: &mut dyn Write, params: Context<'_>) -> Result<()> {
let template_env = params.get_renderer_callback();
let name = self.expr_name.evaluate(params.clone())?.to_string();
Expand Down Expand Up @@ -243,7 +243,7 @@ impl<'a> Statement<'a> {
}
}
}
impl<'a> Render for Statement<'a> {
impl Render for Statement<'_> {
fn render(&self, out: &mut dyn Write, params: Context<'_>) -> Result<()> {
match self {
Statement::If(statement) => statement.render(out, params),
Expand Down
2 changes: 1 addition & 1 deletion src/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl<'a> Template<'a> {
}
}

impl<'a> Render for Template<'a> {
impl Render for Template<'_> {
fn render(&self, out: &mut dyn Write, params: Context<'_>) -> Result<()> {
if let Some(ref renderer) = self.renderer {
let result = renderer.render(out, params);
Expand Down
2 changes: 1 addition & 1 deletion src/value/from.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl From<String> for Value {
}
}

impl<'a> From<&'a str> for Value {
impl From<&str> for Value {
fn from(f: &str) -> Self {
Value::String(f.to_string())
}
Expand Down

0 comments on commit 604ddf7

Please sign in to comment.