Skip to content

Commit

Permalink
fix: warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
kabouzeid committed Mar 28, 2023
1 parent b4b0fa4 commit ffd1211
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/app.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crossbeam::{
channel::{unbounded, Receiver, Sender},
channel::{unbounded, Receiver},
select,
};
use std::path::PathBuf;
Expand Down Expand Up @@ -29,9 +29,9 @@ pub struct App {
job_list_state: ListState,
job_stdout: Option<String>,
job_stdout_offset: u16,
job_watcher: JobWatcherHandle,
_job_watcher: JobWatcherHandle,
job_stdout_watcher: FileWatcherHandle,
sender: Sender<AppMessage>,
// sender: Sender<AppMessage>,
receiver: Receiver<AppMessage>,
input_receiver: Receiver<crossterm::Result<Event>>,
}
Expand Down Expand Up @@ -61,12 +61,12 @@ impl App {
Self {
focus: Focus::Jobs,
jobs: Vec::new(),
job_watcher: JobWatcherHandle::new(sender.clone(), Duration::from_secs(2)),
_job_watcher: JobWatcherHandle::new(sender.clone(), Duration::from_secs(2)),
job_list_state: ListState::default(),
job_stdout: None,
job_stdout_offset: 0,
job_stdout_watcher: FileWatcherHandle::new(sender.clone()),
sender: sender,
// sender,
receiver: receiver,
input_receiver: input_receiver,
}
Expand Down
8 changes: 4 additions & 4 deletions src/file_watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ impl FileWatcher {
})
.unwrap();

let (mut content_sender, mut content_receiver) = unbounded::<Option<String>>();
let (mut _content_sender, mut _content_receiver) = unbounded::<Option<String>>();
let (mut _watch_sender, mut _watch_receiver) = unbounded::<()>();
loop {
select! {
recv(self.receiver) -> msg => {
match msg.unwrap() {
FileWatcherMessage::FilePath(file_path) => {
(content_sender, content_receiver) = unbounded();
(_content_sender, _content_receiver) = unbounded();
(_watch_sender, _watch_receiver) = unbounded::<()>();

if let Some(p) = &self.file_path {
Expand All @@ -76,7 +76,7 @@ impl FileWatcher {
Ok(_) => {
self.file_path = Some(p);
let p = self.file_path.clone();
thread::spawn(move || FileReader::new(content_sender, _watch_receiver, p).run());
thread::spawn(move || FileReader::new(_content_sender, _watch_receiver, p).run());
},
Err(e) => self.app.send(AppMessage::JobStdout(Some(format!("Failed to watch {:?}: {}", p, e)))).unwrap()
};
Expand All @@ -85,7 +85,7 @@ impl FileWatcher {
}
}
recv(watch_receiver) -> _ => { _watch_sender.send(()).unwrap(); }
recv(content_receiver) -> msg => {
recv(_content_receiver) -> msg => {
self.app.send(AppMessage::JobStdout(msg.unwrap())).unwrap();
}
}
Expand Down

0 comments on commit ffd1211

Please sign in to comment.