From 8fc80ecd107a40cdfecffcdc881043a7ebfec71d Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Sun, 30 Jan 2022 11:21:45 +0800 Subject: [PATCH] Fix formatting. --- src/bin/rhai-repl.rs | 5 +++-- src/module/mod.rs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/bin/rhai-repl.rs b/src/bin/rhai-repl.rs index 5f60a199..6e964182 100644 --- a/src/bin/rhai-repl.rs +++ b/src/bin/rhai-repl.rs @@ -328,8 +328,9 @@ fn main() { match rl.readline(prompt) { // Line continuation - Ok(line) if line.ends_with("\\") => { - input += &line[..line.len() - 1]; + Ok(mut line) if line.ends_with("\\") => { + line.pop(); + input += line.trim_end(); input.push('\n'); } Ok(line) => { diff --git a/src/module/mod.rs b/src/module/mod.rs index d85a3fb0..e842fc1d 100644 --- a/src/module/mod.rs +++ b/src/module/mod.rs @@ -1434,7 +1434,7 @@ impl Module { self.functions.entry(k).or_insert_with(|| v.clone()); } for (&k, v) in &other.type_iterators { - self.type_iterators.entry(k).or_insert(v.clone()); + self.type_iterators.entry(k).or_insert_with(|| v.clone()); } self.all_functions.clear(); self.all_variables.clear();