From e1ebbedc27b40a61842c1e85c638f48c524448b9 Mon Sep 17 00:00:00 2001 From: "max.nuding" Date: Wed, 7 Dec 2022 09:28:35 +0100 Subject: [PATCH] Simplified parent access --- src/day07/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/day07/mod.rs b/src/day07/mod.rs index 33c0c86..a61e5ba 100644 --- a/src/day07/mod.rs +++ b/src/day07/mod.rs @@ -18,7 +18,7 @@ pub fn run() { for line in read("07").lines().skip(1) { if line.starts_with("$ cd") { current_directory = match line.split_once("cd ").unwrap().1 { - dirname if ".." == dirname => current_directory.ancestors(arena).nth(1).unwrap(), + dirname if ".." == dirname => arena.get(current_directory).unwrap().parent().unwrap(), dirname => current_directory .children(arena) .find(|c|arena.get(*c).unwrap().get().name == dirname)