Skip to content

Commit

Permalink
Switch a few things to lazy evaulation (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock authored Jun 28, 2024
1 parent 0170204 commit 536a324
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bluejay-core/src/executable/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ pub trait Field {
fn selection_set(&self) -> Option<&Self::SelectionSet>;

fn response_name(&self) -> &str {
self.alias().unwrap_or(self.name())
self.alias().unwrap_or_else(|| self.name())
}
}
2 changes: 1 addition & 1 deletion bluejay-parser/src/ast/executable/variable_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl<'a> FromTokens<'a> for VariableType<'a> {
let is_required = bang_span.is_some();
let span = bang_span
.map(|bang_span| name.span().merge(&bang_span))
.unwrap_or(name.span().clone());
.unwrap_or_else(|| name.span().clone());
Ok(Self::Named {
name,
is_required,
Expand Down
2 changes: 1 addition & 1 deletion bluejay-parser/src/lexer/logos_lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ fn validate_number_no_trailing_name_start<'a>(
.remainder()
.chars()
.position(|c| !(c.is_ascii_alphanumeric() || matches!(c, '_' | '.')))
.unwrap_or(lexer.remainder().len());
.unwrap_or_else(|| lexer.remainder().len());

lexer.bump(invalid_trail_bytes);

Expand Down

0 comments on commit 536a324

Please sign in to comment.