Fixed compiler warnings.
This commit is contained in:
@@ -10,7 +10,7 @@ pub fn task1() {
|
|||||||
for line in input.lines() {
|
for line in input.lines() {
|
||||||
let mut counts = [0u8; 26];
|
let mut counts = [0u8; 26];
|
||||||
for c in line.chars() {
|
for c in line.chars() {
|
||||||
counts[(c as usize - 'a' as usize)] += 1;
|
counts[c as usize - 'a' as usize] += 1;
|
||||||
}
|
}
|
||||||
if counts.iter().any(|count| *count == 2) {
|
if counts.iter().any(|count| *count == 2) {
|
||||||
count_two += 1;
|
count_two += 1;
|
||||||
@@ -138,7 +138,7 @@ fn check_children_for_match(node: &Node<'_>) -> Option<String> {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
// go over all suffixes and count their occurences. If # = 2, match!
|
// go over all suffixes and count their occurrences. If # = 2, match!
|
||||||
let mut suffix_counter: HashMap<&str, usize> = HashMap::new();
|
let mut suffix_counter: HashMap<&str, usize> = HashMap::new();
|
||||||
for suffix_set in suffix_candidates.values() {
|
for suffix_set in suffix_candidates.values() {
|
||||||
for suffix in suffix_set {
|
for suffix in suffix_set {
|
||||||
@@ -164,7 +164,7 @@ fn add_id_to_tree<'a>(root: &mut Node<'a>, id: &'a str) {
|
|||||||
current.same_prefix.insert(id);
|
current.same_prefix.insert(id);
|
||||||
for (i, c) in id.chars().enumerate() {
|
for (i, c) in id.chars().enumerate() {
|
||||||
{
|
{
|
||||||
let mut next = current.outgoing.entry(c).or_insert(Node::default());
|
let next = current.outgoing.entry(c).or_insert(Node::default());
|
||||||
next.depth = i + 1;
|
next.depth = i + 1;
|
||||||
next.same_prefix.insert(id);
|
next.same_prefix.insert(id);
|
||||||
next.prefix = &id[..=i];
|
next.prefix = &id[..=i];
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ fn perform_round(map: &[Vec<char>], carts: &mut Vec<Cart>) {
|
|||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
for cart_index in 0..carts.len() {
|
for cart_index in 0..carts.len() {
|
||||||
let mut cart = &mut carts[cart_index];
|
let cart = &mut carts[cart_index];
|
||||||
if !cart.active {
|
if !cart.active {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user