From e5252720192064c8dfee6b869e8a5859d08e4a94 Mon Sep 17 00:00:00 2001 From: edef Date: Fri, 27 Oct 2023 12:31:12 +0000 Subject: refactor(tvix): turn nullary enum variants into unit variants Change-Id: Iad4f2cb4aa92b5bb29ead6050348a8cd3e7b8632 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9860 Reviewed-by: flokli Tested-by: BuildkiteCI --- tvix/castore/src/proto/mod.rs | 4 ++-- tvix/castore/src/proto/tests/directory.rs | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'tvix/castore') diff --git a/tvix/castore/src/proto/mod.rs b/tvix/castore/src/proto/mod.rs index cd7ea66b8ccd..f590c6841336 100644 --- a/tvix/castore/src/proto/mod.rs +++ b/tvix/castore/src/proto/mod.rs @@ -48,7 +48,7 @@ pub enum ValidateNodeError { InvalidDigestLen(usize), /// Invalid name encountered #[error("Invalid name")] - InvalidName(), + InvalidName, /// Invalid symlink target #[error("Invalid symlink target: {}", .0.as_bstr())] InvalidSymlinkTarget(Vec), @@ -63,7 +63,7 @@ fn validate_node_name(name: &[u8]) -> Result<(), ValidateNodeError> { || name.contains(&0x00) || name.contains(&b'/') { - Err(ValidateNodeError::InvalidName())?; + Err(ValidateNodeError::InvalidName)?; } Ok(()) } diff --git a/tvix/castore/src/proto/tests/directory.rs b/tvix/castore/src/proto/tests/directory.rs index d4de19b77114..0464a268292c 100644 --- a/tvix/castore/src/proto/tests/directory.rs +++ b/tvix/castore/src/proto/tests/directory.rs @@ -165,7 +165,7 @@ fn validate_invalid_names() { ..Default::default() }; match d.validate().expect_err("must fail") { - ValidateDirectoryError::InvalidNode(n, ValidateNodeError::InvalidName()) => { + ValidateDirectoryError::InvalidNode(n, ValidateNodeError::InvalidName) => { assert_eq!(n, b"") } _ => panic!("unexpected error"), @@ -182,7 +182,7 @@ fn validate_invalid_names() { ..Default::default() }; match d.validate().expect_err("must fail") { - ValidateDirectoryError::InvalidNode(n, ValidateNodeError::InvalidName()) => { + ValidateDirectoryError::InvalidNode(n, ValidateNodeError::InvalidName) => { assert_eq!(n, b".") } _ => panic!("unexpected error"), @@ -200,7 +200,7 @@ fn validate_invalid_names() { ..Default::default() }; match d.validate().expect_err("must fail") { - ValidateDirectoryError::InvalidNode(n, ValidateNodeError::InvalidName()) => { + ValidateDirectoryError::InvalidNode(n, ValidateNodeError::InvalidName) => { assert_eq!(n, b"..") } _ => panic!("unexpected error"), @@ -216,7 +216,7 @@ fn validate_invalid_names() { ..Default::default() }; match d.validate().expect_err("must fail") { - ValidateDirectoryError::InvalidNode(n, ValidateNodeError::InvalidName()) => { + ValidateDirectoryError::InvalidNode(n, ValidateNodeError::InvalidName) => { assert_eq!(n, b"\x00") } _ => panic!("unexpected error"), @@ -232,7 +232,7 @@ fn validate_invalid_names() { ..Default::default() }; match d.validate().expect_err("must fail") { - ValidateDirectoryError::InvalidNode(n, ValidateNodeError::InvalidName()) => { + ValidateDirectoryError::InvalidNode(n, ValidateNodeError::InvalidName) => { assert_eq!(n, b"foo/bar") } _ => panic!("unexpected error"), -- cgit 1.4.1