Skip to content

Commit

Permalink
comments, removed unnessicary borrow
Browse files Browse the repository at this point in the history
  • Loading branch information
geremachek committed Aug 6, 2021
1 parent 76bfc72 commit b06a3e5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "merlin"
version = "1.0.17"
version = "1.0.18"
authors = ["geremachek <mrender2005@gmail.com>"]
edition = "2018"

Expand Down
4 changes: 2 additions & 2 deletions src/plane/plane_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

extern crate shellexpand;

use super::{Plane, nomen::Nomen};
use std::{fs::File, io::{BufRead, BufReader}};
use crate::{volume::Volume, error::MerlinError};
use super::{Plane, nomen::Nomen};

impl Plane {
// return the name of a volume
Expand All @@ -25,7 +25,7 @@ impl Plane {
// open a new file

pub fn summon(&mut self, path: &str) -> Result<(), MerlinError> {
Ok(self.push_volume(Volume::from_file(&shellexpand::tilde(&path))?))
Ok(self.push_volume(Volume::from_file(&shellexpand::tilde(path))?))
}

// close a file / buffer
Expand Down
6 changes: 3 additions & 3 deletions src/volume/vol_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl Volume {
// view a piece of text

pub fn peer(&self, b: usize, e: usize) -> Result<String, MerlinError> {
if b >= 1 && e <= self.buffer.len() && b <= e {
if b >= 1 && e <= self.buffer.len() && b <= e { // coords to view are valid
Ok(self.buffer.as_slice()[b-1..e].join("\n"))
} else {
Err(MerlinError::OutOfBounds)
Expand Down Expand Up @@ -94,9 +94,9 @@ impl Volume {
// overwrite text

pub fn trample(&mut self, s: &str) {
if s.is_empty() {
if s.is_empty() { // if our text is empty, clear the line
self.buffer[self.line].clear();
} else {
} else { // else, clear the line(s)
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
self.buffer.push(line.to_string());
Expand Down

0 comments on commit b06a3e5

Please sign in to comment.