Skip to content

Commit

Permalink
implemented clippy's suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
ijchen committed Feb 15, 2024
1 parent db4af33 commit cf202b6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions src/ast/ast_node_formatted_string_literal.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::fmt::Display;
use std::fmt::{Display, Write};

use crate::source_range::SourceRange;

Expand Down Expand Up @@ -71,12 +71,15 @@ impl Display for AstNodeFormattedStringLiteral<'_> {
"{}",
format_as_node(
&format!(
"[Formatted String Literal] {}...{}{}",
"[Formatted String Literal] {}{}{}",
self.start.0,
self.continuations
.iter()
.map(|(s, _)| format!("{s}..."))
.collect::<String>(),
.fold("...".to_string(), |mut accumulator, (s, _)| {
write!(accumulator, "{s}...").unwrap();

accumulator
}),
self.end
),
vec![self.start.1.to_string()]
Expand Down
2 changes: 1 addition & 1 deletion src/interpreter/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ macro_rules! impl_simple_bin_op {
$rhs_type: ident => $result: expr
),+$(,)?}
) => {
pub fn $func_name<'source>(
pub fn $func_name(
$lhs: Value,
$rhs: Value,
) -> Result<Value, OperationError> {
Expand Down
2 changes: 1 addition & 1 deletion src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ fn parse_if_else_statement<'source>(

// Parse any else-if statements
loop {
match (token_stream.get(0), token_stream.get(1)) {
match (token_stream.front(), token_stream.get(1)) {
(Some(Token::Keyword(token_else)), Some(Token::Keyword(token_if)))
if token_else.keyword() == Keyword::Else && token_if.keyword() == Keyword::If =>
{
Expand Down

0 comments on commit cf202b6

Please sign in to comment.