Skip to content

Commit 235f240

Browse files
committed
Rust 2024 Edition formatting
1 parent 59828aa commit 235f240

File tree

22 files changed

+27
-88
lines changed

22 files changed

+27
-88
lines changed

rustfmt.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
style_edition = "2024"
12
use_small_heuristics = "Max"

src/year2016/day05.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//! [`Year 2015 Day 4`]: crate::year2015::day04
77
use crate::util::md5::*;
88
use crate::util::thread::*;
9-
use std::sync::atomic::{AtomicBool, AtomicU32, Ordering};
109
use std::sync::Mutex;
10+
use std::sync::atomic::{AtomicBool, AtomicU32, Ordering};
1111

1212
struct Shared {
1313
prefix: String,

src/year2016/day07.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,7 @@ pub fn part1(input: &[u8]) -> usize {
3838
}
3939
}
4040

41-
if positive && !negative {
42-
count + 1
43-
} else {
44-
count
45-
}
41+
if positive && !negative { count + 1 } else { count }
4642
}
4743

4844
pub fn part2(input: &[u8]) -> usize {
@@ -84,9 +80,5 @@ pub fn part2(input: &[u8]) -> usize {
8480
}
8581
}
8682

87-
if positive {
88-
count + 1
89-
} else {
90-
count
91-
}
83+
if positive { count + 1 } else { count }
9284
}

src/year2016/day14.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
use crate::util::md5::*;
66
use crate::util::thread::*;
77
use std::collections::{BTreeMap, BTreeSet};
8-
use std::sync::atomic::{AtomicBool, AtomicI32, Ordering};
98
use std::sync::Mutex;
9+
use std::sync::atomic::{AtomicBool, AtomicI32, Ordering};
1010

1111
/// Atomics can be safely shared between threads.
1212
struct Shared<'a> {

src/year2017/day14.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//! [`Day 10`]: crate::year2017::day10
77
//! [`Day 12`]: crate::year2017::day12
88
use crate::util::thread::*;
9-
use std::sync::atomic::{AtomicUsize, Ordering};
109
use std::sync::Mutex;
10+
use std::sync::atomic::{AtomicUsize, Ordering};
1111

1212
/// Atomics can be safely shared between threads.
1313
pub struct Shared {

src/year2017/day15.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::util::iter::*;
1111
use crate::util::math::*;
1212
use crate::util::parse::*;
1313
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
14-
use std::sync::mpsc::{channel, Receiver, Sender};
14+
use std::sync::mpsc::{Receiver, Sender, channel};
1515
use std::thread;
1616

1717
const PART_ONE: usize = 40_000_000;

src/year2018/day14.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//! * Vector processing of recipes using techniques similar to SIMD.
1313
use crate::util::parse::*;
1414
use std::sync::atomic::{AtomicBool, Ordering};
15-
use std::sync::mpsc::{channel, Receiver, Sender};
15+
use std::sync::mpsc::{Receiver, Sender, channel};
1616
use std::thread;
1717

1818
type Input = (String, usize);

src/year2018/day15.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ use crate::util::grid::*;
8080
use crate::util::point::*;
8181
use crate::util::thread::*;
8282
use std::sync::atomic::{AtomicBool, AtomicI32, Ordering};
83-
use std::sync::mpsc::{channel, Sender};
83+
use std::sync::mpsc::{Sender, channel};
8484

8585
const READING_ORDER: [Point; 4] = [UP, LEFT, RIGHT, DOWN];
8686

src/year2018/day19.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,5 @@ fn divisor_sum(mut n: u32) -> u32 {
114114
// If `n` is one then the greatest prime factor was repeated so has already been included in
115115
// the sum and we can just return it directly. Otherwise `n` is the unique greatest prime
116116
// factor and must be added to the sum.
117-
if n == 1 {
118-
sum
119-
} else {
120-
sum * (1 + n)
121-
}
117+
if n == 1 { sum } else { sum * (1 + n) }
122118
}

src/year2018/day24.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::util::hash::*;
1111
use crate::util::parse::*;
1212
use crate::util::thread::*;
1313
use std::sync::atomic::{AtomicBool, AtomicI32, Ordering};
14-
use std::sync::mpsc::{channel, Sender};
14+
use std::sync::mpsc::{Sender, channel};
1515

1616
pub struct Input {
1717
immune: Vec<Group>,

0 commit comments

Comments
 (0)