Skip to content

Commit

Permalink
Fixes compilation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sanpii committed Jun 14, 2022
1 parent 8038de9 commit e7fc379
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/edit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl Widget {
self.widgets.subject.set_text(task.subject.as_str());
self.components
.priority
.emit(crate::widgets::priority::Msg::Set(task.priority));
.emit(crate::widgets::priority::Msg::Set(task.priority.clone().into()));
self.widgets.flag.set_active(task.flagged);
self.components
.due
Expand Down Expand Up @@ -128,7 +128,7 @@ impl Widget {
}

fn update_priority(&mut self, priority: u8) {
self.model.task.priority = priority;
self.model.task.priority = priority.into();
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/tasks/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ impl std::str::FromStr for Task {
type Err = ();

fn from_str(s: &str) -> Result<Self, ()> {
let inner = todo_txt::task::Extended::from_str(s)?;
let inner = todo_txt::task::Extended::from_str(s)
.map_err(|_| ())?;

Ok(Self { inner, id: 0 })
}
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ impl relm::Widget for Task {
context.add_class("finished");
}

if task.priority < 26 {
let priority = (b'a' + task.priority) as char;
if task.priority < 26.into() {
let priority = (b'a' + u8::from(task.priority.clone())) as char;
context.add_class(format!("pri_{}", priority).as_str());
}

Expand Down

0 comments on commit e7fc379

Please sign in to comment.