Simplify code.

This commit is contained in:
Stephen Chung
2020-10-01 23:31:27 +08:00
parent a13fcc5cc2
commit e8d5f78f88
5 changed files with 104 additions and 89 deletions

View File

@@ -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())
}
}