From d5e23cb321c8b0073d17239e7cccb7a8c583c1a6 Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Wed, 13 Mar 2024 07:43:24 +0100 Subject: [PATCH] [db] Use fully qualified import paths in UserValue macro #1051 (#1052) * Update lib.rs * Update db_user_value_test.rs --- agdb/tests/db_user_value_test.rs | 6 ++++-- agdb_derive/src/lib.rs | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/agdb/tests/db_user_value_test.rs b/agdb/tests/db_user_value_test.rs index e7937e68..608ebcf4 100644 --- a/agdb/tests/db_user_value_test.rs +++ b/agdb/tests/db_user_value_test.rs @@ -7,6 +7,8 @@ use agdb::DbUserValue; use agdb::DbValue; use agdb::QueryBuilder; use agdb::UserValue; +#[allow(unused_imports)] +use std::fmt::Result; use test_db::TestDb; #[derive(Default, Debug, Clone, PartialEq)] @@ -35,7 +37,7 @@ impl From for DbValue { impl TryFrom for Status { type Error = DbError; - fn try_from(value: DbValue) -> Result { + fn try_from(value: DbValue) -> std::result::Result { if value.to_u64()? == 0 { Ok(Status::Inactive) } else { @@ -418,7 +420,7 @@ fn derived_macro_should_not_panic() { 1, ); - let user: Result = db + let user: std::result::Result = db .exec_result(QueryBuilder::search().from(1).query()) .try_into(); diff --git a/agdb_derive/src/lib.rs b/agdb_derive/src/lib.rs index 4bf95840..602b5749 100644 --- a/agdb_derive/src/lib.rs +++ b/agdb_derive/src/lib.rs @@ -95,7 +95,7 @@ pub fn db_user_value_derive(item: TokenStream) -> TokenStream { vec![#(#db_keys.into()),*] } - fn from_db_element(element: &agdb::DbElement) -> Result { + fn from_db_element(element: &agdb::DbElement) -> std::result::Result { Ok(Self { #(#from_db_element),* }) @@ -109,7 +109,7 @@ pub fn db_user_value_derive(item: TokenStream) -> TokenStream { impl TryFrom<&agdb::DbElement> for #name { type Error = agdb::DbError; - fn try_from(value: &agdb::DbElement) -> Result { + fn try_from(value: &agdb::DbElement) -> std::result::Result { use agdb::DbUserValue; #name::from_db_element(value) } @@ -118,7 +118,7 @@ pub fn db_user_value_derive(item: TokenStream) -> TokenStream { impl TryFrom for #name { type Error = agdb::DbError; - fn try_from(value: agdb::QueryResult) -> Result { + fn try_from(value: agdb::QueryResult) -> std::result::Result { use agdb::DbUserValue; value .elements