clippy: fix warnings

This commit is contained in:
Valentin Tolmer
2021-05-14 09:28:15 +02:00
parent e0bcb58d36
commit e524fb0f55
3 changed files with 15 additions and 9 deletions

View File

@@ -10,7 +10,8 @@ pub struct LoginForm {
on_logged_in: Callback<String>,
error: Option<anyhow::Error>,
node_ref: NodeRef,
task: Option<FetchTask>,
// Used to keep the request alive long enough.
_task: Option<FetchTask>,
}
#[derive(Clone, PartialEq, Properties)]
@@ -33,7 +34,7 @@ impl Component for LoginForm {
on_logged_in: props.on_logged_in,
error: None,
node_ref: NodeRef::default(),
task: None,
_task: None,
}
}
@@ -61,7 +62,7 @@ impl Component for LoginForm {
req,
self.link.callback(Msg::AuthenticationResponse),
) {
Ok(task) => self.task = Some(task),
Ok(task) => self._task = Some(task),
Err(e) => self.error = Some(e),
}
}

View File

@@ -7,8 +7,9 @@ use yew::services::{fetch::FetchTask, ConsoleService};
pub struct UserTable {
link: ComponentLink<Self>,
task: Option<FetchTask>,
users: Option<Result<Vec<User>>>,
// Used to keep the request alive long enough.
_task: Option<FetchTask>,
}
pub enum Msg {
@@ -18,9 +19,9 @@ pub enum Msg {
impl UserTable {
fn get_users(&mut self, req: ListUsersRequest) {
match HostService::list_users(req, self.link.callback(Msg::ListUsersResponse)) {
Ok(task) => self.task = Some(task),
Ok(task) => self._task = Some(task),
Err(e) => {
self.task = None;
self._task = None;
ConsoleService::log(format!("Error trying to fetch users: {}", e).as_str())
}
};
@@ -34,7 +35,7 @@ impl Component for UserTable {
fn create(_: Self::Properties, link: ComponentLink<Self>) -> Self {
let mut table = UserTable {
link: link.clone(),
task: None,
_task: None,
users: None,
};
table.get_users(ListUsersRequest { filters: None });