diff options
Diffstat (limited to 'rust/src/printer.rs')
| -rw-r--r-- | rust/src/printer.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/rust/src/printer.rs b/rust/src/printer.rs index f46b66c..591822b 100644 --- a/rust/src/printer.rs +++ b/rust/src/printer.rs @@ -3,7 +3,7 @@ use types::MalVal; pub fn escape_str(s: &str) -> String { let mut escaped = String::new(); escaped.push('"'); - for c in s.as_slice().chars() { + for c in s.chars() { let _ = match c { '"' => escaped.push_str("\\\""), '\\' => escaped.push_str("\\\\"), @@ -24,7 +24,7 @@ pub fn escape_str(s: &str) -> String { pub fn unescape_str(s: &str) -> String { let re1 = regex!(r#"\\""#); let re2 = regex!(r#"\n"#); - re2.replace_all(re1.replace_all(s.as_slice(), "\"").as_slice(), "\n") + re2.replace_all(&re1.replace_all(&s, "\""), "\n") } pub fn pr_list(lst: &Vec<MalVal>, pr: bool, @@ -38,7 +38,7 @@ pub fn pr_list(lst: &Vec<MalVal>, pr: bool, } else { res.push_str(join); } - res.push_str(mv.pr_str(pr).as_slice()); + res.push_str(&mv.pr_str(pr)); } res.push_str(end); res |
