mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Merge pull request #115 from djmitche/issue110
Fix clippy warnings and make them all errors
This commit is contained in:
commit
7594144a2d
12 changed files with 24 additions and 23 deletions
|
@ -13,7 +13,7 @@ pub(crate) fn execute<W: WriteColor>(
|
|||
_ => "(no description)".to_owned(),
|
||||
};
|
||||
let t = replica.new_task(Status::Pending, description).unwrap();
|
||||
write!(w, "added task {}\n", t.get_uuid())?;
|
||||
writeln!(w, "added task {}", t.get_uuid())?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ use termcolor::WriteColor;
|
|||
|
||||
pub(crate) fn execute<W: WriteColor>(w: &mut W, replica: &mut Replica) -> Fallible<()> {
|
||||
replica.gc()?;
|
||||
write!(w, "garbage collected.\n")?;
|
||||
writeln!(w, "garbage collected.")?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ pub(crate) fn execute<W: WriteColor>(
|
|||
server: &mut Box<dyn Server>,
|
||||
) -> Fallible<()> {
|
||||
replica.sync(server)?;
|
||||
write!(w, "sync complete.\n")?;
|
||||
writeln!(w, "sync complete.")?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ use termcolor::{ColorSpec, WriteColor};
|
|||
pub(crate) fn execute<W: WriteColor>(w: &mut W) -> Fallible<()> {
|
||||
write!(w, "TaskChampion ")?;
|
||||
w.set_color(ColorSpec::new().set_bold(true))?;
|
||||
write!(w, "{}\n", env!("CARGO_PKG_VERSION"))?;
|
||||
writeln!(w, "{}", env!("CARGO_PKG_VERSION"))?;
|
||||
w.reset()?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -36,10 +36,7 @@ pub(super) fn filtered_tasks(
|
|||
let mut res = vec![];
|
||||
|
||||
fn is_partial_uuid(taskid: &TaskId) -> bool {
|
||||
match taskid {
|
||||
TaskId::PartialUuid(_) => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(taskid, TaskId::PartialUuid(_))
|
||||
}
|
||||
|
||||
// We will enumerate the universe of tasks for this filter, checking
|
||||
|
@ -50,7 +47,7 @@ pub(super) fn filtered_tasks(
|
|||
Universe::IdList(ref ids) if ids.iter().any(is_partial_uuid) => {
|
||||
'task: for (uuid, task) in replica.all_tasks()?.drain() {
|
||||
for id in ids {
|
||||
if match id {
|
||||
let in_universe = match id {
|
||||
TaskId::WorkingSetId(id) => {
|
||||
// NOTE: (#108) this results in many reads of the working set; it
|
||||
// may be better to cache this information here or in the Replica.
|
||||
|
@ -58,11 +55,10 @@ pub(super) fn filtered_tasks(
|
|||
}
|
||||
TaskId::PartialUuid(prefix) => uuid.to_string().starts_with(prefix),
|
||||
TaskId::Uuid(id) => id == &uuid,
|
||||
} {
|
||||
if match_task(filter, &task) {
|
||||
res.push(task);
|
||||
continue 'task;
|
||||
}
|
||||
};
|
||||
if in_universe && match_task(filter, &task) {
|
||||
res.push(task);
|
||||
continue 'task;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ use filter::filtered_tasks;
|
|||
use modify::apply_modification;
|
||||
|
||||
/// Invoke the given Command in the context of the given settings
|
||||
#[allow(clippy::needless_return)]
|
||||
pub(crate) fn invoke(command: Command, settings: Config) -> Fallible<()> {
|
||||
log::debug!("command: {:?}", command);
|
||||
log::debug!("settings: {:?}", settings);
|
||||
|
@ -88,7 +89,7 @@ pub(crate) fn invoke(command: Command, settings: Config) -> Fallible<()> {
|
|||
subcommand: Subcommand::Version,
|
||||
..
|
||||
} => unreachable!(),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// utilities for invoke
|
||||
|
|
|
@ -43,7 +43,7 @@ pub(super) fn apply_modification<W: WriteColor>(
|
|||
task.remove_tag(&tag)?;
|
||||
}
|
||||
|
||||
write!(w, "modified task {}\n", task.get_uuid())?;
|
||||
writeln!(w, "modified task {}", task.get_uuid())?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue