mirror of
https://github.com/tiffany352/rink-rs
synced 2024-11-10 05:34:14 +00:00
Fix warnings
This commit is contained in:
parent
294adcd6a3
commit
79aebd9a17
5 changed files with 14 additions and 17 deletions
|
@ -33,19 +33,19 @@ impl<'a> Iterator for TokenIterator<'a> {
|
|||
return None
|
||||
}
|
||||
let res = match self.0.next().unwrap() {
|
||||
letter @ 'A'...'Z' => {
|
||||
letter @ 'A'..='Z' => {
|
||||
let mut symbol = String::new();
|
||||
symbol.push(letter);
|
||||
match self.0.peek().cloned() {
|
||||
Some('a'...'z') => symbol.push(self.0.next().unwrap()),
|
||||
Some('a'..='z') => symbol.push(self.0.next().unwrap()),
|
||||
_ => ()
|
||||
}
|
||||
Token::Symbol(symbol)
|
||||
}
|
||||
digit @ '0'...'9' => {
|
||||
digit @ '0'..='9' => {
|
||||
let mut integer = String::new();
|
||||
integer.push(digit);
|
||||
while let Some('0'...'9') = self.0.peek().cloned() {
|
||||
while let Some('0'..='9') = self.0.peek().cloned() {
|
||||
integer.push(self.0.next().unwrap())
|
||||
}
|
||||
Token::Count(u32::from_str(&integer).unwrap())
|
||||
|
|
|
@ -105,7 +105,7 @@ impl<'a> Iterator for TokenIterator<'a> {
|
|||
}
|
||||
Token::Newline
|
||||
},
|
||||
x @ '0'...'9' | x @ '.' => {
|
||||
x @ '0'..='9' | x @ '.' => {
|
||||
let mut integer = String::new();
|
||||
let mut frac = None;
|
||||
let mut exp = None;
|
||||
|
@ -115,7 +115,7 @@ impl<'a> Iterator for TokenIterator<'a> {
|
|||
integer.push(x);
|
||||
while let Some(c) = self.0.peek().cloned() {
|
||||
match c {
|
||||
'0'...'9' => integer.push(self.0.next().unwrap()),
|
||||
'0'..='9' => integer.push(self.0.next().unwrap()),
|
||||
_ => break
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ impl<'a> Iterator for TokenIterator<'a> {
|
|||
}
|
||||
while let Some(c) = self.0.peek().cloned() {
|
||||
match c {
|
||||
'0'...'9' => buf.push(self.0.next().unwrap()),
|
||||
'0'..='9' => buf.push(self.0.next().unwrap()),
|
||||
_ => break
|
||||
}
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ impl<'a> Iterator for TokenIterator<'a> {
|
|||
}
|
||||
while let Some(c) = self.0.peek().cloned() {
|
||||
match c {
|
||||
'0'...'9' => buf.push(self.0.next().unwrap()),
|
||||
'0'..='9' => buf.push(self.0.next().unwrap()),
|
||||
_ => break
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,7 +152,6 @@ static CURRENCY_FILE: &'static str = include_str!("../currency.units");
|
|||
/// Creates a context by searching standard directories for definitions.units.
|
||||
pub fn load() -> Result<Context, String> {
|
||||
use std::io::Read;
|
||||
use std::fs::File;
|
||||
use std::path::Path;
|
||||
|
||||
let mut path = try!(config_dir());
|
||||
|
|
|
@ -458,8 +458,6 @@ impl Number {
|
|||
}
|
||||
|
||||
pub fn pow(&self, exp: &Number) -> Result<Number, String> {
|
||||
use std::convert::Into;
|
||||
|
||||
if !exp.dimless() {
|
||||
return Err(format!("Exponent must be dimensionless"))
|
||||
}
|
||||
|
|
|
@ -149,14 +149,14 @@ impl<'a> Iterator for TokenIterator<'a> {
|
|||
},
|
||||
_ => Token::Slash
|
||||
},
|
||||
x @ '0'...'9' | x @ '.' => {
|
||||
x @ '0'..='9' | x @ '.' => {
|
||||
if x == '0' && self.0.peek() == Some(&'x') {
|
||||
self.0.next();
|
||||
let mut hex = String::new();
|
||||
|
||||
while let Some(c) = self.0.peek().cloned() {
|
||||
match c {
|
||||
'0'...'9' | 'a'...'f' | 'A'...'F' =>
|
||||
'0'..='9' | 'a'..='f' | 'A'..='F' =>
|
||||
hex.push(self.0.next().unwrap()),
|
||||
'\u{2009}' | '_' => {
|
||||
self.0.next();
|
||||
|
@ -177,7 +177,7 @@ impl<'a> Iterator for TokenIterator<'a> {
|
|||
|
||||
while let Some(c) = self.0.peek().cloned() {
|
||||
match c {
|
||||
'0'...'7' =>
|
||||
'0'..='7' =>
|
||||
oct.push(self.0.next().unwrap()),
|
||||
'\u{2009}' | '_' => {
|
||||
self.0.next();
|
||||
|
@ -222,7 +222,7 @@ impl<'a> Iterator for TokenIterator<'a> {
|
|||
integer.push(x);
|
||||
while let Some(c) = self.0.peek().cloned() {
|
||||
match c {
|
||||
'0'...'9' => integer.push(self.0.next().unwrap()),
|
||||
'0'..='9' => integer.push(self.0.next().unwrap()),
|
||||
'\u{2009}' | '_' => {
|
||||
self.0.next();
|
||||
},
|
||||
|
@ -240,7 +240,7 @@ impl<'a> Iterator for TokenIterator<'a> {
|
|||
}
|
||||
while let Some(c) = self.0.peek().cloned() {
|
||||
match c {
|
||||
'0'...'9' => buf.push(self.0.next().unwrap()),
|
||||
'0'..='9' => buf.push(self.0.next().unwrap()),
|
||||
'\u{2009}' | '_' => {
|
||||
self.0.next();
|
||||
},
|
||||
|
@ -273,7 +273,7 @@ impl<'a> Iterator for TokenIterator<'a> {
|
|||
}
|
||||
while let Some(c) = self.0.peek().cloned() {
|
||||
match c {
|
||||
'0'...'9' => buf.push(self.0.next().unwrap()),
|
||||
'0'..='9' => buf.push(self.0.next().unwrap()),
|
||||
'\u{2009}' | '_' => {
|
||||
self.0.next();
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue