fix(derive): Code is no longer required

This commit is contained in:
Kat Marchán 2021-09-17 11:33:39 -07:00
parent eb1b7222fc
commit 8a0f71e6d1
No known key found for this signature in database
GPG Key ID: AEB529C08A3C7E9E
1 changed files with 4 additions and 5 deletions

View File

@ -66,15 +66,14 @@ impl WhichFn {
Self::Snippets => quote! { Self::Snippets => quote! {
fn snippets(&self) -> std::option::Option<std::boxed::Box<dyn std::iter::Iterator<Item = miette::DiagnosticSnippet> + '_>> fn snippets(&self) -> std::option::Option<std::boxed::Box<dyn std::iter::Iterator<Item = miette::DiagnosticSnippet> + '_>>
}, },
Self::Related => quote! {
fn related<'a>(&'a self) -> std::option::Option<std::boxed::Box<dyn std::iter::Iterator<Item = &'a dyn miette::Diagnostic> + 'a>>
},
} }
} }
pub fn catchall_arm(&self) -> TokenStream { pub fn catchall_arm(&self) -> TokenStream {
match self { quote! { _ => std::option::Option::None }
// required, hence method can't return None
Self::Code => quote! {},
_ => quote! { _ => None, },
}
} }
} }