Simplify code.
This commit is contained in:
@@ -403,9 +403,9 @@ impl ExportedFn {
|
||||
|
||||
pub(crate) fn exported_name<'n>(&'n self) -> Cow<'n, str> {
|
||||
if let Some(ref name) = self.params.name {
|
||||
Cow::Borrowed(name.last().unwrap().as_str())
|
||||
name.last().unwrap().as_str().into()
|
||||
} else {
|
||||
Cow::Owned(self.signature.ident.to_string())
|
||||
self.signature.ident.to_string().into()
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -204,9 +204,9 @@ impl Module {
|
||||
|
||||
pub fn exported_name(&self) -> Option<Cow<str>> {
|
||||
if let Some(ref s) = self.params.name {
|
||||
Some(Cow::Borrowed(s))
|
||||
Some(s.into())
|
||||
} else {
|
||||
self.module_name().map(|m| Cow::Owned(m.to_string()))
|
||||
self.module_name().map(|m| m.to_string().into())
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user