From abf76c9df7ceb25a510c28a2710b3cb582e9a582 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= <40151420+ldericher@users.noreply.github.com> Date: Thu, 3 Jul 2025 10:32:46 +0000 Subject: [PATCH] move `check_trait` to crate root --- src/lib.rs | 13 +++++++++++++ src/sharry/ids.rs | 13 +------------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index b0754c3..4e979e7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,3 +13,16 @@ mod sharry; pub use appstate::AppState; pub use cli::Cli; pub use error::{Error, Parameter, Result}; + +#[cfg(test)] +#[inline] +pub fn check_trait(expected: &E, actual: &A, tr: &'static str, ty: &'static str) +where + E: std::fmt::Debug + PartialEq, + A: std::fmt::Debug, +{ + assert_eq!( + expected, actual, + "`impl {tr} for {ty}` expected: {expected:?}, actual: {actual:?}", + ); +} diff --git a/src/sharry/ids.rs b/src/sharry/ids.rs index fc63f16..8f2324c 100644 --- a/src/sharry/ids.rs +++ b/src/sharry/ids.rs @@ -102,18 +102,7 @@ impl TryFrom for FileID { #[cfg(test)] mod tests { use super::*; - - #[inline] - fn check_trait(expected: &E, actual: &A, tr: &'static str, ty: &'static str) - where - E: fmt::Debug + PartialEq, - A: fmt::Debug, - { - assert_eq!( - expected, actual, - "`impl {tr} for {ty}` expected: {expected:?}, actual: {actual:?}", - ); - } +use crate::check_trait; #[test] fn basic_traits_working() {