Remove implicit cloning for string values
This commit is contained in:
parent
56fbbdee0b
commit
0c1a2f4499
@ -75,7 +75,7 @@ mod tests {
|
|||||||
None
|
None
|
||||||
)
|
)
|
||||||
.run(&Context::new()),
|
.run(&Context::new()),
|
||||||
Ok(Action::Return(Value::string("foo")))
|
Ok(Action::Return(Value::string("foo".to_string())))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ mod tests {
|
|||||||
))))
|
))))
|
||||||
)
|
)
|
||||||
.run(&Context::new()),
|
.run(&Context::new()),
|
||||||
Ok(Action::Return(Value::string("bar")))
|
Ok(Action::Return(Value::string("bar".to_string())))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,8 +64,8 @@ impl Value {
|
|||||||
Value(Arc::new(ValueInner::Range(range)))
|
Value(Arc::new(ValueInner::Range(range)))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn string<T: ToString>(string: T) -> Self {
|
pub fn string(string: String) -> Self {
|
||||||
Value(Arc::new(ValueInner::String(string.to_string())))
|
Value(Arc::new(ValueInner::String(string)))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn r#enum(name: Identifier, variant: Identifier) -> Self {
|
pub fn r#enum(name: Identifier, variant: Identifier) -> Self {
|
||||||
|
@ -15,7 +15,7 @@ fn loops_and_breaks() {
|
|||||||
}
|
}
|
||||||
"
|
"
|
||||||
),
|
),
|
||||||
Ok(Some(Value::string("foobar")))
|
Ok(Some(Value::string("foobar".to_string())))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ fn loops_and_breaks() {
|
|||||||
fn r#if() {
|
fn r#if() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
interpret("if true 'foobar'"),
|
interpret("if true 'foobar'"),
|
||||||
Ok(Some(Value::string("foobar")))
|
Ok(Some(Value::string("foobar".to_string())))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,6 +31,6 @@ fn r#if() {
|
|||||||
fn if_else() {
|
fn if_else() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
interpret("if false 'foo' else 'bar'"),
|
interpret("if false 'foo' else 'bar'"),
|
||||||
Ok(Some(Value::string("bar")))
|
Ok(Some(Value::string("bar".to_string())))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user