[2018][rust] rustfmt

sorbet
Alpha Chen 6 years ago
parent 09cbeea533
commit 96dfd74aed

@ -7,7 +7,8 @@ use advent_of_code::main;
main!(); main!();
fn solve(input: &str) -> Result<String, Box<Error>> { fn solve(input: &str) -> Result<String, Box<Error>> {
let re = Regex::new(r"(?P<players>\d+) players; last marble is worth (?P<points>\d+) points").unwrap(); let re = Regex::new(r"(?P<players>\d+) players; last marble is worth (?P<points>\d+) points")
.unwrap();
let caps = re.captures(input).unwrap(); let caps = re.captures(input).unwrap();
let player_count = caps.name("players").unwrap().as_str().parse()?; let player_count = caps.name("players").unwrap().as_str().parse()?;
let marble_count: usize = caps.name("points").unwrap().as_str().parse()?; let marble_count: usize = caps.name("points").unwrap().as_str().parse()?;
@ -17,7 +18,11 @@ fn solve(input: &str) -> Result<String, Box<Error>> {
fn play(player_count: usize, marble_count: usize) -> usize { fn play(player_count: usize, marble_count: usize) -> usize {
let mut scores = vec![0; player_count]; let mut scores = vec![0; player_count];
let mut circle = vec![Marble{value: 0, next: 0, prev: 0}]; let mut circle = vec![Marble {
value: 0,
next: 0,
prev: 0,
}];
let mut current_player = 0; let mut current_player = 0;
let mut current_index: usize = 0; let mut current_index: usize = 0;

@ -12,5 +12,5 @@ macro_rules! main {
Ok(()) Ok(())
} }
} };
} }

Loading…
Cancel
Save