Просмотр исходного кода

net: cleanup warnings + run make clippy

lunar-mining 2 лет назад
Родитель
Сommit
deb3ea5936
3 измененных файлов с 6 добавлено и 15 удалено
  1. 3 7
      src/net/hosts/store.rs
  2. 2 6
      src/net/session/mod.rs
  3. 1 2
      src/net/settings.rs

+ 3 - 7
src/net/hosts/store.rs

@@ -25,12 +25,8 @@ use std::{
 };
 
 use log::{debug, error, info, trace, warn};
-use rand::{
-    prelude::{IteratorRandom, SliceRandom},
-    rngs::OsRng,
-    Rng,
-};
-use smol::lock::{Mutex, RwLock};
+use rand::{prelude::IteratorRandom, rngs::OsRng, Rng};
+use smol::lock::RwLock;
 use url::Url;
 
 use super::super::{p2p::P2pPtr, settings::SettingsPtr};
@@ -1094,7 +1090,7 @@ impl Hosts {
         // Collect the greylist and anchorlist entries, and append any whitelist entries to the
         // greylist before saving.
         for (name, mut list) in self.hostlist_fetch_safe().await {
-            if name == "greylist".to_string() {
+            if name == *"greylist".to_string() {
                 list.append(&mut whitelist)
             }
             for (url, last_seen) in list {

+ 2 - 6
src/net/session/mod.rs

@@ -16,15 +16,11 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-use std::{
-    sync::{Arc, Weak},
-    time::UNIX_EPOCH,
-};
+use std::sync::{Arc, Weak};
 
 use async_trait::async_trait;
-use log::{debug, warn};
+use log::debug;
 use smol::Executor;
-use url::Url;
 
 use super::{channel::ChannelPtr, p2p::P2pPtr, protocol::ProtocolVersion};
 use crate::Result;

+ 1 - 2
src/net/settings.rs

@@ -86,8 +86,7 @@ impl Default for Settings {
         let app_version = semver::Version::parse(version).unwrap();
         // TODO: We don't have a cross-platform method for the app directory (.local/darkfi)
         // in util/path.rs currently.
-        let hostlist =
-            String::from(format!("~/.local/darkfi/{}/hostlist.tsv", env!("CARGO_PKG_NAME")));
+        let hostlist = format!("~/.local/darkfi/{}/hostlist.tsv", env!("CARGO_PKG_NAME"));
 
         Self {
             node_id: String::new(),