Skip to content

Commit

Permalink
✨feature: lint clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
tom8zds committed Jul 3, 2024
1 parent f5b08ad commit dffa640
Show file tree
Hide file tree
Showing 10 changed files with 122 additions and 127 deletions.
202 changes: 105 additions & 97 deletions pubspec.lock

Large diffs are not rendered by default.

7 changes: 2 additions & 5 deletions rust/src/actor/core.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
use std::{collections::HashMap, net::Ipv4Addr, str::FromStr};
use std::{net::Ipv4Addr, str::FromStr};

use log::debug;
use tokio::sync::{mpsc, oneshot, watch};

use super::{
device::DeviceActorHandle,
http::HttpServerHandle,
mission::MissionHandle,
model::{Mission, NodeDevice},
device::DeviceActorHandle, http::HttpServerHandle, mission::MissionHandle, model::NodeDevice,
};

#[derive(Clone)]
Expand Down
2 changes: 1 addition & 1 deletion rust/src/actor/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use tokio::sync::watch;

use tokio::net::UdpSocket;

use crate::actor::model::{NodeAnnounce, NodeDevice};
use crate::actor::model::NodeDevice;

use super::core::CoreActorHandle;

Expand Down
2 changes: 0 additions & 2 deletions rust/src/actor/mission/pending.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::collections::HashMap;

use log::debug;
use tokio::sync::{mpsc, oneshot, watch};

Expand Down
10 changes: 5 additions & 5 deletions rust/src/actor/mission/transfer.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{collections::HashMap, sync::Mutex};
use std::collections::HashMap;

use log::debug;
use tokio::sync::{mpsc, oneshot, watch};
Expand Down Expand Up @@ -143,7 +143,7 @@ impl Actor {
files.insert(k, info);
}

let (tx, rx) = watch::channel(TransferMissionDto {
let (_tx, _rx) = watch::channel(TransferMissionDto {
state: MissionState::Transfering,
files: files.values().map(|x| x.clone()).collect::<Vec<_>>(),
});
Expand All @@ -158,7 +158,7 @@ impl Actor {
let _ = respond_to.send(Ok(()));
}
Message::Listen { respond_to } => match &self.store.mission {
Some(mission) => {
Some(_mission) => {
let rx = self.listener.clone();
let _ = respond_to.send(Ok(rx));
}
Expand Down Expand Up @@ -214,8 +214,8 @@ impl Actor {
}
Message::StateTask {
id,
token,
state,
token: _,
state: _,
respond_to,
} => {
match &self.store.mission {
Expand Down
3 changes: 1 addition & 2 deletions rust/src/actor/model.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::collections::HashMap;

use serde_derive::{Deserialize, Serialize};
use tokio::sync::watch;

use crate::api::model::FileInfo;

Expand Down Expand Up @@ -82,7 +81,7 @@ impl Mission {
let id = uuid::Uuid::new_v4().to_string();
let mut token_map = HashMap::new();
let mut reverse_token_map = HashMap::new();
info_map.iter().for_each(|(key, value)| {
info_map.iter().for_each(|(key, _value)| {
let token = uuid::Uuid::new_v4().to_string();
reverse_token_map.insert(key.clone(), token.clone());
token_map.insert(token.clone(), key.clone());
Expand Down
8 changes: 4 additions & 4 deletions rust/src/api/v2.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::{collections::HashMap, net::SocketAddr, sync::Arc};
use std::{net::SocketAddr, sync::Arc};

use super::model::{FileInfo, FileRequest, FileResponse, UploadTask};
use super::model::{FileRequest, FileResponse, UploadTask};
use axum::{
body::{Bytes, HttpBody},
extract::{ConnectInfo, Path, Query, Request, State},
body::Bytes,
extract::{ConnectInfo, Query, Request, State},
http::StatusCode,
routing::{get, post},
BoxError, Json, Router,
Expand Down
11 changes: 2 additions & 9 deletions rust/src/bridge.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
use std::{
net::{IpAddr, SocketAddr},
sync::Arc,
};
use std::net::{IpAddr, SocketAddr};

use futures::lock::Mutex;
use lazy_static::lazy_static;
use tokio::{
net::UdpSocket,
sync::{watch, OnceCell},
};
use tokio::{net::UdpSocket, sync::OnceCell};

use crate::{
actor::{
Expand Down
2 changes: 1 addition & 1 deletion rust/src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::frb_generated::StreamSink;
use lazy_static::lazy_static;
use log::{error, info, warn, Log, Metadata, Record};
use parking_lot::RwLock;
use serde_derive::{Deserialize, Serialize};

use simplelog::*;

static INIT_LOGGER_ONCE: Once = Once::new();
Expand Down
2 changes: 1 addition & 1 deletion rust/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::task::{Context, Poll};
use std::time::Duration;

use pin_project_lite::pin_project;
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
use tokio::io::AsyncWrite;
use tokio::sync::watch::Sender;
use tokio::time::{interval, Interval};

Expand Down

0 comments on commit dffa640

Please sign in to comment.