Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuichiueda committed Jan 22, 2025
1 parent 38d2154 commit ed50417
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
12 changes: 3 additions & 9 deletions src/error/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,8 @@ impl From<&ExecError> for String {
}

impl ExecError {
pub fn print(&self, core: &mut ShellCore) {
let name = core.db.get_param("0").unwrap();
let s: String = From::<&ExecError>::from(self);
if core.flags.contains('i') {
eprintln!("{}: {}", &name, &s);
}else{
let lineno = core.db.get_param("LINENO").unwrap_or("".to_string());
eprintln!("{}: line {}: {}", &name, &lineno, s);
}
pub fn print(&self, _: &mut ShellCore) {
let s: String = From::from(self);
eprintln!("{}", &s);
}
}
12 changes: 3 additions & 9 deletions src/error/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,8 @@ impl From<&ParseError> for String {
}

impl ParseError {
pub fn print(&self, core: &mut ShellCore) {
let name = core.db.get_param("0").unwrap();
let s: String = From::<&ParseError>::from(self);
if core.flags.contains('i') {
eprintln!("{}: {}", &name, &s);
}else{
let lineno = core.db.get_param("LINENO").unwrap_or("".to_string());
eprintln!("{}: line {}: {}", &name, &lineno, s);
}
pub fn print(&self, _: &mut ShellCore) {
let s: String = From::from(self);
eprintln!("{}", &s);
}
}

0 comments on commit ed50417

Please sign in to comment.