summaryrefslogtreecommitdiffstats
path: root/src/value.rs
diff options
context:
space:
mode:
authorRyan Leckey <leckey.ryan@gmail.com>2017-01-28 22:07:13 -0800
committerRyan Leckey <leckey.ryan@gmail.com>2017-01-28 22:07:13 -0800
commitc1bcf6ec5537bfd0fb3f1ee8d93a32aa15031cff (patch)
tree05fd0b9a2daae99543a9d5ae3a6e15eebc622055 /src/value.rs
parent7d870758cbd9ad4181471ad40184d1bac1204e1e (diff)
Propagate Cow into Source
Diffstat (limited to 'src/value.rs')
-rw-r--r--src/value.rs5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/value.rs b/src/value.rs
index ad173e8..82aef4c 100644
--- a/src/value.rs
+++ b/src/value.rs
@@ -20,10 +20,7 @@ impl<'a> Value<'a> {
/// Gets the underlying value as a string, performing a conversion only if neccessary.
pub fn as_str(&'a self) -> Option<Cow<'a, str>> {
if let Value::String(ref value) = *self {
- Some(match *value {
- Cow::Borrowed(v) => Cow::Borrowed(v),
- Cow::Owned(ref v) => Cow::Borrowed(v),
- })
+ Some(Cow::Borrowed(&*value))
} else if let Value::Integer(value) = *self {
Some(Cow::Owned(value.to_string()))
} else if let Value::Float(value) = *self {