From 16e7e35865a16cfa8dc877c1986d0bffda0944eb Mon Sep 17 00:00:00 2001 From: Agathangelos Stylianidis Date: Mon, 4 Sep 2023 14:09:24 +0300 Subject: [PATCH] fix: Use full path of `Result` type Fixes #905 --- prost-derive/src/field/map.rs | 4 ++-- prost-derive/src/field/scalar.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/prost-derive/src/field/map.rs b/prost-derive/src/field/map.rs index aabceb1f1..4855cc5c6 100644 --- a/prost-derive/src/field/map.rs +++ b/prost-derive/src/field/map.rs @@ -276,14 +276,14 @@ impl Field { #[doc=#get_doc] pub fn #get(&self, key: #key_ref_ty) -> ::core::option::Option<#ty> { self.#ident.get(#take_ref key).cloned().and_then(|x| { - let result: Result<#ty, _> = ::core::convert::TryFrom::try_from(x); + let result: ::core::result::Result<#ty, _> = ::core::convert::TryFrom::try_from(x); result.ok() }) } #[doc=#insert_doc] pub fn #insert(&mut self, key: #key_ty, value: #ty) -> ::core::option::Option<#ty> { self.#ident.insert(key, value as i32).and_then(|x| { - let result: Result<#ty, _> = ::core::convert::TryFrom::try_from(x); + let result: ::core::result::Result<#ty, _> = ::core::convert::TryFrom::try_from(x); result.ok() }) } diff --git a/prost-derive/src/field/scalar.rs b/prost-derive/src/field/scalar.rs index fa426b7fd..5a3dfb2ec 100644 --- a/prost-derive/src/field/scalar.rs +++ b/prost-derive/src/field/scalar.rs @@ -219,7 +219,7 @@ impl Field { struct #wrap_name<'a>(&'a i32); impl<'a> ::core::fmt::Debug for #wrap_name<'a> { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - let res: Result<#ty, _> = ::core::convert::TryFrom::try_from(*self.0); + let res: ::core::result::Result<#ty, _> = ::core::convert::TryFrom::try_from(*self.0); match res { Err(_) => ::core::fmt::Debug::fmt(&self.0, f), Ok(en) => ::core::fmt::Debug::fmt(&en, f), @@ -316,7 +316,7 @@ impl Field { #[doc=#get_doc] pub fn #get(&self) -> #ty { self.#ident.and_then(|x| { - let result: Result<#ty, _> = ::core::convert::TryFrom::try_from(x); + let result: ::core::result::Result<#ty, _> = ::core::convert::TryFrom::try_from(x); result.ok() }).unwrap_or(#default) } @@ -341,7 +341,7 @@ impl Field { fn(i32) -> ::core::option::Option<#ty>, > { self.#ident.iter().cloned().filter_map(|x| { - let result: Result<#ty, _> = ::core::convert::TryFrom::try_from(x); + let result: ::core::result::Result<#ty, _> = ::core::convert::TryFrom::try_from(x); result.ok() }) }