diff --git a/src/pretty.rs b/src/pretty.rs index 65587b3e..9c6975b8 100644 --- a/src/pretty.rs +++ b/src/pretty.rs @@ -4,7 +4,6 @@ use proc_macro2::{Delimiter, TokenTree}; use quote::ToTokens; -use syn::ReturnType; /// Convert a TokenStream representing some code to a reasonably formatted /// string of Rust code. @@ -69,19 +68,6 @@ pub(crate) fn tokens_to_pretty_string(t: T) -> String { b } -pub(crate) fn return_type_to_pretty_string(return_type: &ReturnType) -> String { - match return_type { - ReturnType::Default => String::new(), - ReturnType::Type(arrow, typ) => { - format!( - "{} {}", - arrow.to_token_stream(), - tokens_to_pretty_string(typ) - ) - } - } -} - #[cfg(test)] mod test { use pretty_assertions::assert_eq; @@ -90,7 +76,7 @@ mod test { use super::tokens_to_pretty_string; #[test] - fn pretty_format() { + fn pretty_format_examples() { assert_eq!( tokens_to_pretty_string(quote! { > :: next diff --git a/src/visit.rs b/src/visit.rs index a3fa7398..d6dcef2c 100644 --- a/src/visit.rs +++ b/src/visit.rs @@ -17,7 +17,7 @@ use syn::{Attribute, Expr, ItemFn, ReturnType}; use tracing::{debug, debug_span, trace, trace_span, warn}; use crate::fnvalue::return_type_replacements; -use crate::pretty::{return_type_to_pretty_string, tokens_to_pretty_string}; +use crate::pretty::tokens_to_pretty_string; use crate::source::SourceFile; use crate::*; @@ -135,7 +135,7 @@ struct DiscoveryVisitor<'o> { impl<'o> DiscoveryVisitor<'o> { fn collect_fn_mutants(&mut self, return_type: &ReturnType, span: &proc_macro2::Span) { let full_function_name = Arc::new(self.namespace_stack.join("::")); - let return_type_str = Arc::new(return_type_to_pretty_string(return_type)); + let return_type_str = Arc::new(tokens_to_pretty_string(return_type)); let mut new_mutants = return_type_replacements(return_type, self.error_exprs) .map(|rep| Mutant { source_file: Arc::clone(&self.source_file),