From 665f858bf5176d18d6fe952fa77221178d8a0a37 Mon Sep 17 00:00:00 2001 From: Philipp Korber Date: Tue, 4 Dec 2018 16:12:17 +0100 Subject: fix(headers) make enum explicitly use std::result::Result Before it just used `Result` which can collide with custom result types. --- headers/src/map/mod.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/headers/src/map/mod.rs b/headers/src/map/mod.rs index 22de165..7718bd3 100644 --- a/headers/src/map/mod.rs +++ b/headers/src/map/mod.rs @@ -624,8 +624,7 @@ impl<'a, H> Debug for TypedBodiesMut<'a, H> macro_rules! headers { ($($header:ty : $val:expr),*) => ({ //FIXME[rust/catch block] use catch block once available - (|| -> Result<$crate::HeaderMap, $crate::error::ComponentCreationError> - { + (|| -> ::std::result::Result<$crate::HeaderMap, $crate::error::ComponentCreationError> { let mut map = $crate::HeaderMap::new(); $( map.insert(<$header as $crate::HeaderKind>::auto_body($val)?); @@ -1039,4 +1038,15 @@ mod test { assert_eq!(3, map.len()); }); + + test!(does_not_conflic_with_custom_result_type { + #[allow(unused)] + type Result = ::std::result::Result; + + let map = headers! { + Subject: "yay" + }?; + + assert_eq!(1, map.len()); + }); } \ No newline at end of file -- cgit v1.2.3