From e8fbb00ada31f2988e024d6ab40df2dc382d6030 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Sun, 16 Jan 2022 16:48:08 +0000 Subject: [PATCH] Reduce `futures` dep to `futures-util` (#135) --- Cargo.lock | 139 +------------------------------------ Cargo.toml | 5 +- src/engine/fut/analyze.rs | 2 +- src/engine/fut/crawl.rs | 2 +- src/engine/mod.rs | 7 +- src/interactors/crates.rs | 2 +- src/interactors/github.rs | 2 +- src/interactors/mod.rs | 2 +- src/interactors/rustsec.rs | 2 +- src/server/mod.rs | 2 +- 10 files changed, 15 insertions(+), 150 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 13a49cf..c716236 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -306,21 +306,6 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ebd3504ad6116843b8375ad70df74e7bfe83cac77a1f3fe73200c844d43bfe0" -[[package]] -name = "futures" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28560757fe2bb34e79f907794bb6b22ae8b0e5c669b638a1132f2592b19035b4" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - [[package]] name = "futures-channel" version = "0.3.19" @@ -328,7 +313,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba3dda0b6588335f360afc675d0564c17a77a2bda81ca178a4b6081bd86c7f0b" dependencies = [ "futures-core", - "futures-sink", ] [[package]] @@ -337,34 +321,6 @@ version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0c8ff0461b82559810cdccfde3215c3f373807f5e5232b71479bff7bb2583d7" -[[package]] -name = "futures-executor" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29d6d2ff5bb10fb95c85b8ce46538a2e5f5e7fdc755623a7d4529ab8a4ed9d2a" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f9d34af5a1aac6fb380f735fe510746c38067c5bf16c7fd250280503c971b2" - -[[package]] -name = "futures-macro" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dbd947adfffb0efc70599b3ddcf7b5597bb5fa9e245eb99f62b3a5f7bb8bd3c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "futures-sink" version = "0.3.19" @@ -383,13 +339,8 @@ version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b5cf40b47a271f77a8b1bec03ca09044d99d2372c0de244e66430761127164" dependencies = [ - "futures-channel", "futures-core", - "futures-io", - "futures-macro", - "futures-sink", "futures-task", - "memchr", "pin-project-lite", "pin-utils", "slab", @@ -607,15 +558,6 @@ dependencies = [ "serde", ] -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - [[package]] name = "ipnet" version = "2.3.1" @@ -704,15 +646,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "lock_api" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109" -dependencies = [ - "scopeguard", -] - [[package]] name = "log" version = "0.4.14" @@ -893,57 +826,12 @@ dependencies = [ "ttf-parser", ] -[[package]] -name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" -dependencies = [ - "cfg-if", - "instant", - "libc", - "redox_syscall", - "smallvec", - "winapi", -] - [[package]] name = "percent-encoding" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" -[[package]] -name = "pin-project" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1622113ce508488160cff04e6abc60960e676d330e1ca0f77c0b8df17c81438f" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b95af56fee93df76d721d356ac1ca41fccf168bc448eb14049234df764ba3e76" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "pin-project-lite" version = "0.2.7" @@ -1234,12 +1122,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - [[package]] name = "security-framework" version = "2.4.2" @@ -1336,13 +1218,12 @@ dependencies = [ "crates-index", "derive_more", "font-awesome-as-a-crate", - "futures", + "futures-util", "hyper", "indexmap", "lru_time_cache", "maud", "once_cell", - "pin-project", "pulldown-cmark", "relative-path", "reqwest", @@ -1360,15 +1241,6 @@ dependencies = [ "toml", ] -[[package]] -name = "signal-hook-registry" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" -dependencies = [ - "libc", -] - [[package]] name = "slab" version = "0.4.5" @@ -1406,12 +1278,6 @@ dependencies = [ "thread_local", ] -[[package]] -name = "smallvec" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309" - [[package]] name = "smartstring" version = "0.2.9" @@ -1545,10 +1411,7 @@ dependencies = [ "memchr", "mio", "num_cpus", - "once_cell", - "parking_lot", "pin-project-lite", - "signal-hook-registry", "tokio-macros", "winapi", ] diff --git a/Cargo.toml b/Cargo.toml index b036e90..d6f0a60 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,13 +18,12 @@ cadence = "0.27" crates-index = "0.17" derive_more = "0.99" font-awesome-as-a-crate = "0.2" -futures = "0.3" +futures-util = { version = "0.3", default-features = false, features = ["std"] } hyper = { version = "0.14.10", features = ["full"] } indexmap = { version = "1", features = ["serde-1"] } lru_time_cache = "0.11.1" maud = "0.23" once_cell = "1" -pin-project = "1" pulldown-cmark = "0.9" relative-path = { version = "1.3", features = ["serde"] } reqwest = { version = "0.11", features = ["json"] } @@ -36,7 +35,7 @@ serde_json = "1" slog = "2" slog-async = "2" slog-term = "2" -tokio = { version = "1.14", features = ["full"] } +tokio = { version = "1.14", features = ["rt-multi-thread", "macros"] } toml = "0.5" [build-dependencies] diff --git a/src/engine/fut/analyze.rs b/src/engine/fut/analyze.rs index ce620d9..486f0d8 100644 --- a/src/engine/fut/analyze.rs +++ b/src/engine/fut/analyze.rs @@ -1,5 +1,5 @@ use anyhow::Error; -use futures::StreamExt; +use futures_util::StreamExt as _; use crate::{ engine::machines::analyzer::DependencyAnalyzer, diff --git a/src/engine/fut/crawl.rs b/src/engine/fut/crawl.rs index e6c13b8..f22b7a8 100644 --- a/src/engine/fut/crawl.rs +++ b/src/engine/fut/crawl.rs @@ -1,5 +1,5 @@ use anyhow::Error; -use futures::{future::BoxFuture, stream::FuturesOrdered, FutureExt as _, StreamExt as _}; +use futures_util::{future::BoxFuture, stream::FuturesOrdered, FutureExt as _, StreamExt as _}; use relative_path::RelativePathBuf; use crate::models::repo::RepoPath; diff --git a/src/engine/mod.rs b/src/engine/mod.rs index 103451c..327c2a5 100644 --- a/src/engine/mod.rs +++ b/src/engine/mod.rs @@ -8,14 +8,17 @@ use std::{ use anyhow::{anyhow, Error}; use cadence::{MetricSink, NopMetricSink, StatsdClient}; use crates_index::Index; -use futures::{future::try_join_all, stream, StreamExt}; +use futures_util::{ + future::try_join_all, + stream::{self, BoxStream}, + StreamExt as _, +}; use hyper::service::Service; use once_cell::sync::Lazy; use relative_path::{RelativePath, RelativePathBuf}; use rustsec::database::Database; use semver::VersionReq; use slog::Logger; -use stream::BoxStream; use crate::interactors::crates::{GetPopularCrates, QueryCrate}; use crate::interactors::github::GetPopularRepos; diff --git a/src/interactors/crates.rs b/src/interactors/crates.rs index c13fd88..56a2a4b 100644 --- a/src/interactors/crates.rs +++ b/src/interactors/crates.rs @@ -2,7 +2,7 @@ use std::{fmt, str, task::Context, task::Poll}; use anyhow::{anyhow, Error}; use crates_index::{Crate, DependencyKind, Index}; -use futures::FutureExt as _; +use futures_util::FutureExt as _; use hyper::service::Service; use semver::{Version, VersionReq}; use serde::Deserialize; diff --git a/src/interactors/github.rs b/src/interactors/github.rs index 6057168..6f6687e 100644 --- a/src/interactors/github.rs +++ b/src/interactors/github.rs @@ -5,7 +5,7 @@ use std::{ use anyhow::Error; -use futures::FutureExt as _; +use futures_util::FutureExt as _; use hyper::service::Service; use serde::Deserialize; diff --git a/src/interactors/mod.rs b/src/interactors/mod.rs index f6aead6..030174f 100644 --- a/src/interactors/mod.rs +++ b/src/interactors/mod.rs @@ -4,7 +4,7 @@ use std::{ }; use anyhow::{anyhow, Error}; -use futures::FutureExt as _; +use futures_util::FutureExt as _; use hyper::service::Service; use relative_path::RelativePathBuf; diff --git a/src/interactors/rustsec.rs b/src/interactors/rustsec.rs index 5aadafa..e28488e 100644 --- a/src/interactors/rustsec.rs +++ b/src/interactors/rustsec.rs @@ -1,7 +1,7 @@ use std::{fmt, sync::Arc, task::Context, task::Poll}; use anyhow::Error; -use futures::FutureExt as _; +use futures_util::FutureExt as _; use hyper::service::Service; use rustsec::database::Database; diff --git a/src/server/mod.rs b/src/server/mod.rs index 52b5f7e..8230ba1 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -1,6 +1,6 @@ use std::{env, sync::Arc, time::Instant}; -use futures::future; +use futures_util::future; use hyper::{ header::{CACHE_CONTROL, CONTENT_TYPE, ETAG, LOCATION}, Body, Error as HyperError, Method, Request, Response, StatusCode,