Run cargo clippy

This commit is contained in:
Dheepak Krishnamurthy 2020-10-22 22:02:42 -06:00
parent ef37326da3
commit b76a20186b
2 changed files with 8 additions and 14 deletions

View file

@ -408,12 +408,8 @@ impl TTApp {
.expect(format!("Unable to run `task _get rc.context.{}`", self.context_name).as_str())
.stdout,
)
.expect(
format!(
"Unable to decode utf8 from stdout of `task _get rc.context.{}`",
self.context_name
)
.as_str(),
.unwrap_or_else(
|_| panic!("Unable to decode utf8 from stdout of `task _get rc.context.{}`", self.context_name)
);
self.context_filter = self.context_filter.strip_suffix('\n').unwrap_or("").to_string();
}
@ -461,7 +457,7 @@ impl TTApp {
tasks_with_styles
.extend(tasks_with_due_dates.map(|t| (t.due().unwrap().clone().date(), self.style_for_task(t))))
}
return tasks_with_styles;
tasks_with_styles
}
pub fn draw_task(&mut self, f: &mut Frame<impl Backend>) {
@ -1291,13 +1287,12 @@ impl TTApp {
add_tag(&mut task, "ANNOTATED".to_string());
}
if task.tags().is_some() {
let tags = task
if !task
.tags()
.unwrap()
.iter()
.filter(|s| !self.task_report_table.virtual_tags.contains(s))
.collect::<Vec<_>>();
if !tags.is_empty() {
.next().is_none() {
add_tag(&mut task, "TAGGED".to_string());
}
}

View file

@ -155,7 +155,7 @@ impl<'a> Widget for Calendar<'a> {
);
let mut startm = 0 as usize;
if self.months_per_row > area.width as usize / 8 / 3 || self.months_per_row <= 0 {
if self.months_per_row > area.width as usize / 8 / 3 || self.months_per_row == 0 {
self.months_per_row = area.width as usize / 8 / 3;
}
let mut y = area.y;
@ -177,11 +177,10 @@ impl<'a> Widget for Calendar<'a> {
loop {
let endm = std::cmp::min(startm + self.months_per_row, 12);
let mut x = area.x + startx;
for c in startm..endm {
for (c, d) in days.iter_mut().enumerate().skip(startm).take(endm) {
if c > startm {
x += 1;
}
let d = &mut days[c];
let m = d.0.month() as usize;
let s = format!("{:^20}", month_names[m - 1]);
let style = Style::default().bg(Color::Rgb(220, 220, 220));
@ -194,7 +193,7 @@ impl<'a> Widget for Calendar<'a> {
}
y += 1;
let mut x = area.x + startx;
for d in days.iter_mut().skip(startm).take(endm) {
for (_, d) in days.iter_mut().enumerate().skip(startm).take(endm) {
let m = d.0.month() as usize;
let style = Style::default().bg(Color::Rgb(220, 220, 220));
if m == today.month() as usize && self.year + year as i32 == today.year() {