From f930c91086f4878d8864dc58f9e45e749b624cc0 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Wed, 28 Dec 2022 00:15:29 +0100 Subject: chore(tvix/store): use Directory::default in some more places Change-Id: Iebad5e0b38f9506933fa855e1bfb2611d27ff572 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7655 Tested-by: BuildkiteCI Reviewed-by: tazjin --- tvix/store/src/proto.rs | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) (limited to 'tvix/store') diff --git a/tvix/store/src/proto.rs b/tvix/store/src/proto.rs index cee8aeec5472..a9d23bac3977 100644 --- a/tvix/store/src/proto.rs +++ b/tvix/store/src/proto.rs @@ -36,11 +36,7 @@ mod tests { #[test] fn test_directory_size() { { - let d = Directory { - directories: vec![], - files: vec![], - symlinks: vec![], - }; + let d = Directory::default(); assert_eq!(d.size(), 0); } { @@ -50,8 +46,7 @@ mod tests { digest: vec![], size: 0, }], - files: vec![], - symlinks: vec![], + ..Default::default() }; assert_eq!(d.size(), 1); } @@ -62,32 +57,29 @@ mod tests { digest: DUMMY_DIGEST.to_vec(), size: 4, }], - files: vec![], - symlinks: vec![], + ..Default::default() }; assert_eq!(d.size(), 5); } { let d = Directory { - directories: vec![], files: vec![FileNode { name: String::from("foo"), digest: DUMMY_DIGEST.to_vec(), size: 42, executable: false, }], - symlinks: vec![], + ..Default::default() }; assert_eq!(d.size(), 1); } { let d = Directory { - directories: vec![], - files: vec![], symlinks: vec![SymlinkNode { name: String::from("foo"), target: String::from("bar"), }], + ..Default::default() }; assert_eq!(d.size(), 1); } @@ -95,11 +87,7 @@ mod tests { #[test] fn test_digest() { - let d = Directory { - directories: vec![], - files: vec![], - symlinks: vec![], - }; + let d = Directory::default(); assert_eq!( d.digest(), -- cgit 1.4.1