Skip to content

Commit dbc562c

Browse files
committed
Implement clippy hint.
1 parent a400f66 commit dbc562c

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

examples/parse_folder.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ extern crate log;
1414
use clap::{App, Arg};
1515

1616
use rustpython_parser::{ast, parser};
17-
use std::path::{Path, PathBuf};
17+
use std::path::Path;
1818
use std::time::{Duration, Instant};
1919

2020
fn main() {
@@ -77,17 +77,17 @@ fn parse_python_file(filename: &Path) -> ParsedFile {
7777
info!("Parsing file {:?}", filename);
7878
match std::fs::read_to_string(filename) {
7979
Err(e) => ParsedFile {
80-
filename: Box::new(filename.to_path_buf()),
81-
code: "".to_string(),
80+
// filename: Box::new(filename.to_path_buf()),
81+
// code: "".to_string(),
8282
num_lines: 0,
8383
result: Err(e.to_string()),
8484
},
8585
Ok(source) => {
8686
let num_lines = source.to_string().lines().count();
8787
let result = parser::parse_program(&source).map_err(|e| e.to_string());
8888
ParsedFile {
89-
filename: Box::new(filename.to_path_buf()),
90-
code: source.to_string(),
89+
// filename: Box::new(filename.to_path_buf()),
90+
// code: source.to_string(),
9191
num_lines,
9292
result,
9393
}
@@ -140,8 +140,8 @@ struct ScanResult {
140140
}
141141

142142
struct ParsedFile {
143-
filename: Box<PathBuf>,
144-
code: String,
143+
// filename: Box<PathBuf>,
144+
// code: String,
145145
num_lines: usize,
146146
result: ParseResult,
147147
}

parser/src/lexer.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ where
416416
loop {
417417
if let Some(c) = self.take_number(radix) {
418418
value_text.push(c);
419-
} else if self.chr0 == Some('_') && Lexer::<T>::is_digit_of_radix(&self.chr1, radix) {
419+
} else if self.chr0 == Some('_') && Lexer::<T>::is_digit_of_radix(self.chr1, radix) {
420420
self.next_char();
421421
} else {
422422
break;
@@ -427,7 +427,7 @@ where
427427

428428
/// Consume a single character with the given radix.
429429
fn take_number(&mut self, radix: u32) -> Option<char> {
430-
let take_char = Lexer::<T>::is_digit_of_radix(&self.chr0, radix);
430+
let take_char = Lexer::<T>::is_digit_of_radix(self.chr0, radix);
431431

432432
if take_char {
433433
Some(self.next_char().unwrap())
@@ -437,7 +437,7 @@ where
437437
}
438438

439439
/// Test if a digit is of a certain radix.
440-
fn is_digit_of_radix(c: &Option<char>, radix: u32) -> bool {
440+
fn is_digit_of_radix(c: Option<char>, radix: u32) -> bool {
441441
match radix {
442442
2 => match c {
443443
Some('0'..='1') => true,

0 commit comments

Comments
 (0)