Skip to content

Commit

Permalink
[db] Use fully qualified import paths in UserValue macro #1051 (#1052)
Browse files Browse the repository at this point in the history
* Update lib.rs

* Update db_user_value_test.rs
  • Loading branch information
michaelvlach authored Mar 13, 2024
1 parent cb3dc06 commit d5e23cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions agdb/tests/db_user_value_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -35,7 +37,7 @@ impl From<Status> for DbValue {
impl TryFrom<DbValue> for Status {
type Error = DbError;

fn try_from(value: DbValue) -> Result<Self, Self::Error> {
fn try_from(value: DbValue) -> std::result::Result<Self, Self::Error> {
if value.to_u64()? == 0 {
Ok(Status::Inactive)
} else {
Expand Down Expand Up @@ -418,7 +420,7 @@ fn derived_macro_should_not_panic() {
1,
);

let user: Result<User, DbError> = db
let user: std::result::Result<User, DbError> = db
.exec_result(QueryBuilder::search().from(1).query())
.try_into();

Expand Down
6 changes: 3 additions & 3 deletions agdb_derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self, agdb::DbError> {
fn from_db_element(element: &agdb::DbElement) -> std::result::Result<Self, agdb::DbError> {
Ok(Self {
#(#from_db_element),*
})
Expand All @@ -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<Self, Self::Error> {
fn try_from(value: &agdb::DbElement) -> std::result::Result<Self, Self::Error> {
use agdb::DbUserValue;
#name::from_db_element(value)
}
Expand All @@ -118,7 +118,7 @@ pub fn db_user_value_derive(item: TokenStream) -> TokenStream {
impl TryFrom<agdb::QueryResult> for #name {
type Error = agdb::DbError;

fn try_from(value: agdb::QueryResult) -> Result<Self, Self::Error> {
fn try_from(value: agdb::QueryResult) -> std::result::Result<Self, Self::Error> {
use agdb::DbUserValue;
value
.elements
Expand Down

0 comments on commit d5e23cb

Please sign in to comment.