Fix compiler warnings
parent
0fd6e45b5e
commit
4ae1fea299
|
|
@ -30,14 +30,6 @@ pub fn answer(text : String) ->( u16, u16 ) {
|
||||||
( clicks, passing_clicks )
|
( clicks, passing_clicks )
|
||||||
}
|
}
|
||||||
|
|
||||||
fn count_passing_clicks(old : i16, new : i16) -> u16 {
|
|
||||||
if old < new {
|
|
||||||
(new.div_euclid(100) - old.div_euclid(100)).abs() as u16
|
|
||||||
} else {
|
|
||||||
((new - 1).div_euclid(100) - (old - 1).div_euclid(100)).abs() as u16
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn str_to_dir(s : &str) -> Option<i16> {
|
fn str_to_dir(s : &str) -> Option<i16> {
|
||||||
if s.len() < 2 {
|
if s.len() < 2 {
|
||||||
return None;
|
return None;
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ impl BatteryBank {
|
||||||
|
|
||||||
struct BigBatteryBank {
|
struct BigBatteryBank {
|
||||||
highest_digit : Vec<u8>,
|
highest_digit : Vec<u8>,
|
||||||
highest_value : u64,
|
|
||||||
}
|
}
|
||||||
impl BigBatteryBank {
|
impl BigBatteryBank {
|
||||||
fn add_battery(&mut self, b : u8, min_pos : usize) {
|
fn add_battery(&mut self, b : u8, min_pos : usize) {
|
||||||
|
|
@ -43,7 +42,7 @@ impl BigBatteryBank {
|
||||||
match self.highest_digit.get(i) {
|
match self.highest_digit.get(i) {
|
||||||
Some(x) =>
|
Some(x) =>
|
||||||
if b > *x {
|
if b > *x {
|
||||||
self.highest_digit.split_off(i);
|
self.highest_digit.truncate(i);
|
||||||
self.highest_digit.push(b);
|
self.highest_digit.push(b);
|
||||||
return;
|
return;
|
||||||
},
|
},
|
||||||
|
|
@ -56,10 +55,7 @@ impl BigBatteryBank {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn from(s : &str) -> u64 {
|
fn from(s : &str) -> u64 {
|
||||||
let mut bank = BigBatteryBank {
|
let mut bank = BigBatteryBank { highest_digit : Vec::new() };
|
||||||
highest_digit : Vec::new(),
|
|
||||||
highest_value : 0
|
|
||||||
};
|
|
||||||
let l : usize = s.len();
|
let l : usize = s.len();
|
||||||
|
|
||||||
for (i, n) in s.chars().filter_map(utils::char_to_u8).enumerate() {
|
for (i, n) in s.chars().filter_map(utils::char_to_u8).enumerate() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue