Skip to content

Commit

Permalink
derive: use hygenic path for Result in output
Browse files Browse the repository at this point in the history
This stops conflicts with too many generics when type
aliases of `Result` are in scope.
  • Loading branch information
spikespaz committed Dec 30, 2024
1 parent 163f329 commit 72323e4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions derive/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ pub fn emit_struct(s: &Struct, named: bool) -> syn::Result<TokenStream> {
fn insert_child(&mut self,
#node: &::knus::ast::SpannedNode<#span_ty>,
#ctx: &mut ::knus::decode::Context<#span_ty>)
-> Result<bool, ::knus::errors::DecodeError<#span_ty>>
-> ::std::result::Result<bool, ::knus::errors::DecodeError<#span_ty>>
{
#insert_child
}
fn insert_property(&mut self,
#name: &::knus::span::Spanned<Box<str>, #span_ty>,
#value: &::knus::ast::Value<#span_ty>,
#ctx: &mut ::knus::decode::Context<#span_ty>)
-> Result<bool, ::knus::errors::DecodeError<#span_ty>>
-> ::std::result::Result<bool, ::knus::errors::DecodeError<#span_ty>>
{
#insert_property
}
Expand All @@ -124,7 +124,7 @@ pub fn emit_struct(s: &Struct, named: bool) -> syn::Result<TokenStream> {
fn decode_children(
#children: &[::knus::ast::SpannedNode<#span_ty>],
#ctx: &mut ::knus::decode::Context<#span_ty>)
-> Result<Self, ::knus::errors::DecodeError<#span_ty>>
-> ::std::result::Result<Self, ::knus::errors::DecodeError<#span_ty>>
{
#decode_children
#assign_extra
Expand All @@ -140,7 +140,7 @@ pub fn emit_struct(s: &Struct, named: bool) -> syn::Result<TokenStream> {
{
fn decode_node(#node: &::knus::ast::SpannedNode<#span_ty>,
#ctx: &mut ::knus::decode::Context<#span_ty>)
-> Result<Self, ::knus::errors::DecodeError<#span_ty>>
-> ::std::result::Result<Self, ::knus::errors::DecodeError<#span_ty>>
{
#decode_specials
#decode_args
Expand All @@ -164,7 +164,7 @@ pub fn emit_new_type(s: &NewType) -> syn::Result<TokenStream> {
{
fn decode_node(#node: &::knus::ast::SpannedNode<S>,
#ctx: &mut ::knus::decode::Context<S>)
-> Result<Self, ::knus::errors::DecodeError<S>>
-> ::std::result::Result<Self, ::knus::errors::DecodeError<S>>
{
if #node.arguments.len() > 0 ||
#node.properties.len() > 0 ||
Expand Down Expand Up @@ -433,7 +433,7 @@ fn decode_args(s: &Common, node: &syn::Ident) -> syn::Result<TokenStream> {
decoder.push(quote! {
let #fld = #iter_args.map(|#val| {
#decode_value
}).collect::<Result<_, _>>()?;
}).collect::<std::result::Result<_, _>>()?;
});
} else {
decoder.push(quote! {
Expand Down Expand Up @@ -925,7 +925,7 @@ fn decode_children(
match &**#child.node_name {
#(#match_branches)*
}
}).collect::<Result<_, ::knus::errors::DecodeError<_>>>()?;
}).collect::<::std::result::Result<_, ::knus::errors::DecodeError<_>>>()?;
#(#postprocess)*
})
} else {
Expand All @@ -945,7 +945,7 @@ fn decode_children(
match &**#child.node_name {
#(#match_branches)*
}
}).collect::<Result<(), ::knus::errors::DecodeError<_>>>()?;
}).collect::<::std::result::Result<(), ::knus::errors::DecodeError<_>>>()?;
#(#postprocess)*
})
}
Expand Down
2 changes: 1 addition & 1 deletion derive/src/scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub fn emit_enum(e: &Enum) -> syn::Result<TokenStream> {
fn raw_decode(val: &::knus::span::Spanned<
::knus::ast::Literal, S>,
ctx: &mut ::knus::decode::Context<S>)
-> Result<#e_name, ::knus::errors::DecodeError<S>>
-> ::std::result::Result<#e_name, ::knus::errors::DecodeError<S>>
{
match &**val {
::knus::ast::Literal::String(ref s) => {
Expand Down
2 changes: 1 addition & 1 deletion derive/src/variants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub fn emit_enum(e: &Enum) -> syn::Result<TokenStream> {
{
fn decode_node(#node: &::knus::ast::SpannedNode<#span_ty>,
#ctx: &mut ::knus::decode::Context<#span_ty>)
-> Result<Self, ::knus::errors::DecodeError<#span_ty>>
-> ::std::result::Result<Self, ::knus::errors::DecodeError<#span_ty>>
{
#decode
}
Expand Down

0 comments on commit 72323e4

Please sign in to comment.