From fb87b4c4e496df93fd2c225b889b9387ce3880f5 Mon Sep 17 00:00:00 2001 From: geremachek Date: Tue, 13 Jul 2021 17:11:42 -0700 Subject: [PATCH] code quality = none --- src/plane/parse.rs | 4 ++-- src/volume/vol_commands.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plane/parse.rs b/src/plane/parse.rs index ca1dae7..0a6b7c4 100644 --- a/src/plane/parse.rs +++ b/src/plane/parse.rs @@ -153,8 +153,8 @@ impl Plane { cvol.set_written(false); match command { - Command::Inscribe => cvol.inscribe(data.remove(0)), - Command::Trample => cvol.trample(data.remove(0)), + Command::Inscribe => cvol.inscribe(&data[0]), + Command::Trample => cvol.trample(&data[0]), Command::Burn => cvol.burn(), Command::Shave => cvol.shave(parse_pos::(&data[0])?), _ => (), diff --git a/src/volume/vol_commands.rs b/src/volume/vol_commands.rs index 1acdbb5..ee40d02 100644 --- a/src/volume/vol_commands.rs +++ b/src/volume/vol_commands.rs @@ -69,7 +69,7 @@ impl Volume { // inset some text into the buffer - pub fn inscribe(&mut self, s: String) { + pub fn inscribe(&mut self, s: &str) { if !s.is_empty() { let mut lines = s.lines(); @@ -95,9 +95,9 @@ impl Volume { // overwrite text - pub fn trample(&mut self, s: String) { + pub fn trample(&mut self, s: &str) { if s.is_empty() { - self.buffer[self.line] = s; + self.buffer[self.line].clear(); } else { for (i, line) in s.lines().enumerate() { if self.line + i >= self.buffer.len() { // the length of the piece of text excedes the length of the buffer