From b17f7207359cb2059dd7277f9ec816921147c485 Mon Sep 17 00:00:00 2001 From: alyx Date: Mon, 20 Nov 2023 17:52:42 -0500 Subject: remove warnings --- 2015/rs/code/eight/src/main.rs | 6 +++--- 2015/rs/code/four/src/main.rs | 12 ++++++------ 2015/rs/code/nine/src/main.rs | 3 +-- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/2015/rs/code/eight/src/main.rs b/2015/rs/code/eight/src/main.rs index b51f436..6917a54 100644 --- a/2015/rs/code/eight/src/main.rs +++ b/2015/rs/code/eight/src/main.rs @@ -5,7 +5,7 @@ enum ParseState { Verbatim, Esc, Hex1, - Hex2(u32) + Hex2 } fn main() { @@ -25,8 +25,8 @@ fn main() { (ParseState::Esc, 'x') => { state = ParseState::Hex1; }, (ParseState::Esc, c) => { buf.push(c); state = ParseState::Verbatim; }, - (ParseState::Hex1, c) => { state = ParseState::Hex2(c.to_digit(16).unwrap() * 16); }, - (ParseState::Hex2(n), c) => { buf.push(/*char::from_u32(n + c.to_digit(16).unwrap()).unwrap()*/'?'); state = ParseState::Verbatim; }, + (ParseState::Hex1, _) => { state = ParseState::Hex2; }, + (ParseState::Hex2, _) => { buf.push('?'); state = ParseState::Verbatim; }, } } (s, buf) diff --git a/2015/rs/code/four/src/main.rs b/2015/rs/code/four/src/main.rs index 177ddc5..0888816 100644 --- a/2015/rs/code/four/src/main.rs +++ b/2015/rs/code/four/src/main.rs @@ -9,16 +9,16 @@ fn main() { buf.extend_from_slice(INPUT); for i in 0.. { - if i % 1000 == 0 { print!("{i}\r"); std::io::stdout().flush(); } + if i % 1000 == 0 { print!("{i}\r"); let _ = std::io::stdout().flush(); } let mut hasher = Md5::new(); - write!(&mut buf, "{i}"); + let _ = write!(&mut buf, "{i}"); hasher.update(buf.as_slice()); let hash = hasher.finalize(); if hash.starts_with(&[0, 0]) && hash[2] < 16 { let mut hexhash = String::with_capacity(32); for digit in hash { - write!(&mut hexhash, "{digit:02x}"); + let _ = write!(&mut hexhash, "{digit:02x}"); } println!("Got 5 digit hash: {hexhash}, at {i}"); break; @@ -27,16 +27,16 @@ fn main() { } for i in 0.. { - if i % 1000 == 0 { print!("{i}\r"); std::io::stdout().flush(); } + if i % 1000 == 0 { print!("{i}\r"); let _ = std::io::stdout().flush(); } let mut hasher = Md5::new(); - write!(&mut buf, "{i}"); + let _ = write!(&mut buf, "{i}"); hasher.update(buf.as_slice()); let hash = hasher.finalize(); if hash.starts_with(&[0, 0, 0]) { let mut hexhash = String::with_capacity(32); for digit in hash { - write!(&mut hexhash, "{digit:02x}"); + let _ = write!(&mut hexhash, "{digit:02x}"); } println!("Got 6 digit hash: {hexhash}, at {i}"); break; diff --git a/2015/rs/code/nine/src/main.rs b/2015/rs/code/nine/src/main.rs index 46116e0..408b66a 100644 --- a/2015/rs/code/nine/src/main.rs +++ b/2015/rs/code/nine/src/main.rs @@ -1,7 +1,6 @@ #![feature(iter_next_chunk)] -use std::collections::{HashSet, HashMap}; -use std::io::Write; +use std::collections::HashMap; static INPUT: &'static str = include_str!("input.txt"); -- cgit v1.2.3-70-g09d2