Skip to content

Commit

Permalink
#101 - clippy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirMarkelov committed Nov 25, 2024
1 parent a384921 commit c203e5a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
5 changes: 1 addition & 4 deletions src/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,7 @@ impl Conf {
Default::default()
}
pub fn editor(&self) -> Option<PathBuf> {
let mut spth: String = match env::var(EDITOR) {
Ok(p) => p,
Err(_) => String::new(),
};
let mut spth: String = env::var(EDITOR).unwrap_or_default();
if spth.is_empty() {
if let Some(p) = &self.editor_path {
spth = p.clone();
Expand Down
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ fn task_edit(stdout: &mut StandardStream, tasks: &mut todo::TaskVec, conf: &conf
continue;
}
// TODO: move duplicated code (here and in task_add) to a separate fn
let mut tag_list = date_expr::TaskTagList::from_str(&subj, now);
let mut tag_list = date_expr::TaskTagList::from_str(subj, now);
let soon = conf.fmt.colors.soon_days;
let subj = match date_expr::calculate_main_tags(now, &mut tag_list, soon) {
Err(e) => {
Expand All @@ -561,7 +561,7 @@ fn task_edit(stdout: &mut StandardStream, tasks: &mut todo::TaskVec, conf: &conf
}
Ok(changed) => match changed {
false => subj.to_string(),
true => date_expr::update_tags_in_str(&tag_list, &subj),
true => date_expr::update_tags_in_str(&tag_list, subj),
},
};
let mut cnf = conf.clone();
Expand All @@ -580,7 +580,7 @@ fn task_edit(stdout: &mut StandardStream, tasks: &mut todo::TaskVec, conf: &conf
writeln!(stdout, "Removed {removed_cnt} tasks, added {added_cnt} tasks.")?;
}
}
let _ = filepath.close()?;
filepath.close()?;
} else if conf.dry {
let mut clones = todo::clone_tasks(tasks, &todos);
let updated = if conf.keep_tags {
Expand Down
2 changes: 1 addition & 1 deletion ttdl.toml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ old = "1y"
# true = always add completion date, regardless of creation date is presence
# add_completion_date_always = false

# Path an external editor binary.
# Path an external editor binary or the name of the editor binary if it is in PATH.
# It is used when 'edit' command includes the option `--interactive`.
# editor = ""

Expand Down

0 comments on commit c203e5a

Please sign in to comment.