From a0fc94d96049cee159ca2484ac49e24e49e6353a Mon Sep 17 00:00:00 2001 From: Avril Date: Sun, 2 Aug 2020 02:49:17 +0100 Subject: [PATCH] a rust moment --- src/config/parse.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/config/parse.rs b/src/config/parse.rs index a5efb63..63a2a28 100644 --- a/src/config/parse.rs +++ b/src/config/parse.rs @@ -9,17 +9,18 @@ use sexp::{ Atom, }; -fn get_atom_string<'a, T>(maybe_atom: T) -> Result<&'a String, Error> -where T: AsRef + 'a +fn get_atom_string<'a>(maybe_atom: &'a Sexp) -> Result<&'a String, Error> { - match maybe_atom.as_ref() { + match &maybe_atom { Sexp::Atom(Atom::S(string)) => Ok(string), _ => Err(Error::InvalidSexp), } } fn new_job(to: &mut Config, cdr: &[Sexp]) -> Result<(), Error> { - to.job_dirs.push(PathBuf::from(get_atom_string(&cdr[0])?)); + let what = &cdr[0]; + let what = get_atom_string(what)?; + to.job_dirs.push(PathBuf::from(what)); Ok(()) }