Merge empty strings.

This commit is contained in:
Stephen Chung
2021-09-26 21:18:52 +08:00
parent 65a1c24d7b
commit 3557db88e8
5 changed files with 63 additions and 32 deletions

View File

@@ -1877,7 +1877,7 @@ impl Dynamic {
_ => Err(self.type_name()),
}
}
/// Cast the [`Dynamic`] as an [`ImmutableString`] and return it.
/// Cast the [`Dynamic`] as an [`ImmutableString`] and return it as a string slice.
/// Returns the name of the actual type if the cast fails.
///
/// # Panics
@@ -1888,7 +1888,7 @@ impl Dynamic {
match self.0 {
Union::Str(ref s, _, _) => Ok(s),
#[cfg(not(feature = "no_closure"))]
Union::Shared(_, _, _) => panic!("as_str() cannot be called on shared values"),
Union::Shared(_, _, _) => panic!("as_str_ref() cannot be called on shared values"),
_ => Err(self.type_name()),
}
}