WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 7d7c43e

Browse files
committed
chore(clippy): clippy fixes
1 parent ca435fa commit 7d7c43e

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

src/parser/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ impl<'a> Parser<'a> {
131131
/// 1. Advancing the pointer to the current token at least once
132132
/// 2. Invoking the prefix expression parse function for the `previous_token`
133133
/// 3. Successively advancing the pointer to the current token and calling the infix expression
134-
/// parse function for the `current_token` while its precedence is lower than the one that is
135-
/// provided. Lower precedences will subsume more/larger expressions.
134+
/// parse function for the `current_token` while its precedence is lower than the one that is
135+
/// provided. Lower precedences will subsume more/larger expressions.
136136
///
137137
/// # Arguments
138138
/// - `precedence` the precedence of the current token
@@ -200,7 +200,7 @@ impl<'a> Parser<'a> {
200200
///
201201
/// * `token_type` - The expected token type that the parser's `current_token` is sitting on
202202
/// * `error_msg` - The error message that should be emitted if the `current_token`'s type does
203-
/// not match `token_type`
203+
/// not match `token_type`
204204
fn consume(&mut self, token_type: &TokenType, error_msg: &str) {
205205
if self.current_token.expect("No token type").token_type == token_type {
206206
self.advance();

src/value/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl Value {
2525
let mut decimal_flag = false;
2626

2727
for char in val.chars() {
28-
let is_scientific = char.to_ascii_lowercase() == 'e';
28+
let is_scientific = char.eq_ignore_ascii_case(&'e');
2929
let is_one_time_prefix = char == '+' || char == '-';
3030
let is_decimal = char == '.';
3131

src/vm/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -516,9 +516,8 @@ impl VM {
516516

517517
fn peek(&mut self, distance: usize) -> &Value {
518518
let last_index = self.stack.len() - 1;
519-
return self
520-
.stack
519+
self.stack
521520
.get(last_index - distance)
522-
.expect("Unable to peek at stack!");
521+
.expect("Unable to peek at stack!")
523522
}
524523
}

0 commit comments

Comments
 (0)