From a7778e34ab4eef5ca774efbc58e00fa7a00a2e77 Mon Sep 17 00:00:00 2001 From: Denis Evsyukov Date: Mon, 9 Mar 2020 10:05:48 +0300 Subject: [~] simpify donefile --- src/main.rs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/main.rs b/src/main.rs index 72f81de..806d303 100644 --- a/src/main.rs +++ b/src/main.rs @@ -51,6 +51,7 @@ Usage: t [-t DIR] [-l LIST] [options] [TEXT]"; let path = env::current_dir().unwrap(); let taskfile = matches.opt_str("l").unwrap_or_else(|| "tasks".to_string()); + let donefile = format!(".{}.done", taskfile); let taskdir = matches .opt_str("t") .unwrap_or_else(|| path.to_str().unwrap().to_string()); @@ -61,16 +62,6 @@ Usage: t [-t DIR] [-l LIST] [options] [TEXT]"; println!("taskdir: {}", taskpath.to_str().unwrap().to_string()); // read files - let donefile = format!( - ".{}.done", - taskpath - .as_path() - .file_name() - .unwrap() - .to_os_string() - .into_string() - .unwrap() - ); let mut donepath = PathBuf::from(taskpath.as_path().parent().unwrap().to_path_buf()); donepath.push(donefile); -- cgit v1.2.3