summaryrefslogtreecommitdiffstats
path: root/src/parse
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2022-02-28 23:02:46 -0500
committerJesse Luehrs <doy@tozt.net>2022-02-28 23:02:46 -0500
commitb792d9a83d0ed5e71ba4c0ae62730db8fee00216 (patch)
tree45fe04a1e536e5b7df6e9a67bd86efa420667b01 /src/parse
parentb9d919152cfa12bf74d4ffc5d0b1528e3b64857a (diff)
downloadnbsh-b792d9a83d0ed5e71ba4c0ae62730db8fee00216.tar.gz
nbsh-b792d9a83d0ed5e71ba4c0ae62730db8fee00216.zip
push some copies up the stack
Diffstat (limited to 'src/parse')
-rw-r--r--src/parse/ast.rs4
-rw-r--r--src/parse/mod.rs4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/parse/ast.rs b/src/parse/ast.rs
index 1f0cdc2..030ce14 100644
--- a/src/parse/ast.rs
+++ b/src/parse/ast.rs
@@ -12,10 +12,10 @@ pub struct Commands {
}
impl Commands {
- pub fn parse(full_cmd: &str) -> Result<Self, super::Error> {
+ pub fn parse(full_cmd: &String) -> Result<Self, super::Error> {
Ok(Self::build_ast(
Shell::parse(Rule::line, full_cmd)
- .map_err(|e| super::Error::new(full_cmd, e))?
+ .map_err(|e| super::Error::new(full_cmd.clone(), e))?
.next()
.unwrap()
.into_inner()
diff --git a/src/parse/mod.rs b/src/parse/mod.rs
index cc6d92b..9663086 100644
--- a/src/parse/mod.rs
+++ b/src/parse/mod.rs
@@ -106,9 +106,9 @@ pub struct Error {
}
impl Error {
- fn new(input: &str, e: pest::error::Error<ast::Rule>) -> Self {
+ fn new(input: String, e: pest::error::Error<ast::Rule>) -> Self {
Self {
- input: input.to_string(),
+ input,
e,
}
}