Skip to content

Commit

Permalink
Update dependencies (#49)
Browse files Browse the repository at this point in the history
* Update dependencies

* Simplifications for clippy
  • Loading branch information
travisbrown authored Dec 11, 2021
1 parent 5377c39 commit 1c662cd
Show file tree
Hide file tree
Showing 19 changed files with 199 additions and 246 deletions.
347 changes: 160 additions & 187 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ license = "MPL-2.0"
anyhow = "1.0"
bytes = "1.0"
chrono = "0.4"
clap = "3.0.0-beta.2"
clap = { version = "3.0.0-rc.4", features = ["derive"] }
csv="1.1"
data-encoding = "2.3"
displaydoc = "0.2"
Expand All @@ -21,7 +21,7 @@ file_diff = "1.0"
flate2 = "1.0"
fs_extra = "1.2"
futures = "0.3"
futures-locks = "0.6"
futures-locks = "0.7"
futures-util = "0.3"
html5ever = "0.25"
hyper = { version = "0.14", features = [ "stream" ] }
Expand All @@ -40,14 +40,14 @@ scraper = "0.12"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
sha-1 = "0.9"
simplelog = "0.10"
sha-1 = "0.10"
simplelog = "0.11"
tar = "0.4"
tempfile = "3.2"
thiserror = "1.0"
time = "0.3"
tinytemplate = "1.0"
tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] }
tokio = { version = "1.1", features = ["macros", "rt-multi-thread"] }
tokio-test = "0.4"
toml = "0.5"
tryhard = "0.4"
Expand Down
4 changes: 2 additions & 2 deletions src/bin/details.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use cancel_culture::{browser::twitter::parser, cli};
use clap::{crate_authors, crate_version, Parser};
use clap::Parser;
use std::fs::File;

type Void = Result<(), Box<dyn std::error::Error>>;
Expand Down Expand Up @@ -30,7 +30,7 @@ async fn main() -> Void {
}

#[derive(Parser)]
#[clap(name = "details", version = crate_version!(), author = crate_authors!())]
#[clap(name = "details", version, author)]
struct Opts {
/// Level of verbosity
#[clap(short, long, parse(from_occurrences))]
Expand Down
4 changes: 2 additions & 2 deletions src/bin/report.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use cancel_culture::browser::twitter::parser::BrowserTweet;
use cancel_culture::{cli, wbm};
use clap::{crate_authors, crate_version, Parser};
use clap::Parser;
use csv::ReaderBuilder;
use itertools::Itertools;
use std::collections::{HashMap, HashSet};
Expand Down Expand Up @@ -122,7 +122,7 @@ async fn main() -> Void {
}

#[derive(Parser)]
#[clap(name = "report", version = crate_version!(), author = crate_authors!())]
#[clap(name = "report", version, author)]
struct Opts {
/// Level of verbosity
#[clap(short, long, parse(from_occurrences))]
Expand Down
16 changes: 2 additions & 14 deletions src/bin/twcc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use cancel_culture::{
twitter::{extract_status_id, Client, Error, Result},
wayback,
};
use clap::{crate_authors, crate_version, Parser};
use clap::Parser;
use egg_mode::{tweet::Tweet, user::TwitterUser};
use futures::TryStreamExt;
use itertools::Itertools;
Expand Down Expand Up @@ -543,7 +543,7 @@ fn escape_tweet_text(text: &str) -> String {
}

#[derive(Parser)]
#[clap(name = "twcc", version = crate_version!(), author = crate_authors!())]
#[clap(name = "twcc", version, author)]
struct Opts {
/// TOML file containing Twitter API keys
#[clap(short, long, default_value = "keys.toml")]
Expand All @@ -557,32 +557,20 @@ struct Opts {

#[derive(Parser)]
enum SubCommand {
#[clap(version = crate_version!(), author = crate_authors!())]
BlockedFollows(BlockedFollows),
#[clap(version = crate_version!(), author = crate_authors!())]
FollowerReport(FollowerReport),
#[clap(version = crate_version!(), author = crate_authors!())]
LookupReply(LookupReply),
/// Check whether a list of status IDs (from stdin) still exist
#[clap(version = crate_version!(), author = crate_authors!())]
CheckExistence,
#[clap(version = crate_version!(), author = crate_authors!())]
DeletedTweets(DeletedTweets),
#[clap(version = crate_version!(), author = crate_authors!())]
ListFollowers(ListFollowers),
#[clap(version = crate_version!(), author = crate_authors!())]
ListFriends(ListFriends),
#[clap(version = crate_version!(), author = crate_authors!())]
ListBlocks(ListBlocks),
#[clap(version = crate_version!(), author = crate_authors!())]
ListTweets(ListTweets),
#[clap(version = crate_version!(), author = crate_authors!())]
LookupTweets(LookupTweets),
/// Block a list of user IDs (from stdin)
#[clap(version = crate_version!(), author = crate_authors!())]
ImportBlocks,
/// List everyone you follow or who follows you who is not a mutual
#[clap(version = crate_version!(), author = crate_authors!())]
ListUnmutuals,
}

Expand Down
4 changes: 2 additions & 2 deletions src/bin/twcli.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use cancel_culture::{cli, twitter::Client};
use clap::{crate_authors, crate_version, Parser};
use clap::Parser;
use egg_mode::user::UserID;
use futures::{StreamExt, TryStreamExt};
use itertools::Itertools;
Expand Down Expand Up @@ -183,7 +183,7 @@ async fn main() -> Void {
}

#[derive(Parser)]
#[clap(name = "twcli", version = crate_version!(), author = crate_authors!())]
#[clap(name = "twcli", version, author)]
struct Opts {
/// TOML file containing Twitter API keys
#[clap(short, long, default_value = "keys.toml")]
Expand Down
4 changes: 2 additions & 2 deletions src/bin/twdl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use cancel_culture::{
cli,
twitter::{store::Store, Client},
};
use clap::{crate_authors, crate_version, Parser};
use clap::Parser;
use egg_mode::user::TwitterUser;
use futures::{stream::LocalBoxStream, StreamExt, TryStreamExt};
use log::info;
Expand Down Expand Up @@ -82,7 +82,7 @@ async fn add_user_follows(client: &Client, store: &Store, users: &[TwitterUser])
}

#[derive(Parser)]
#[clap(name = "stores", version = crate_version!(), author = crate_authors!())]
#[clap(name = "stores", version, author)]
struct Opts {
/// TOML file containing Twitter API keys
#[clap(short, long, default_value = "keys.toml")]
Expand Down
4 changes: 2 additions & 2 deletions src/bin/twsearch.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use cancel_culture::{browser::make_client_or_panic, cli};
use clap::{crate_authors, crate_version, Parser};
use clap::Parser;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
Expand Down Expand Up @@ -33,7 +33,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
}

#[derive(Parser)]
#[clap(version = crate_version!(), author = crate_authors!())]
#[clap(version, author)]
struct Opts {
/// TOML file containing Twitter API keys
#[clap(short, long, default_value = "keys.toml")]
Expand Down
4 changes: 2 additions & 2 deletions src/bin/twshoot.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use cancel_culture::{browser, twitter};
use clap::{crate_authors, crate_version, Parser};
use clap::Parser;
use image::DynamicImage;
use std::path::PathBuf;
use std::time::Duration;
Expand Down Expand Up @@ -63,7 +63,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
}

#[derive(Parser)]
#[clap(version = crate_version!(), author = crate_authors!())]
#[clap(version, author)]
struct Opts {
/// Either a tweet URL or a status ID
status: String,
Expand Down
7 changes: 2 additions & 5 deletions src/bin/wbdl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use cancel_culture::{
cli,
wayback::{cdx::Client, Result, Store},
};
use clap::{crate_authors, crate_version, Parser};
use clap::Parser;
use std::collections::HashSet;
use std::io::BufRead;

Expand Down Expand Up @@ -66,7 +66,7 @@ async fn main() -> Result<()> {
}

#[derive(Parser)]
#[clap(name = "wbdl", version = crate_version!(), author = crate_authors!())]
#[clap(name = "wbdl", version, author)]
struct Opts {
/// Wayback Machine store directory
#[clap(short, long, default_value = "wayback")]
Expand All @@ -85,13 +85,10 @@ struct Opts {

#[derive(Parser)]
enum SubCommand {
#[clap(version = crate_version!(), author = crate_authors!())]
Query(CdxQuery),
/// Perform a search for a batch of queries from stdin
#[clap(version = crate_version!(), author = crate_authors!())]
Batch,
/// Download items given CDX search results
#[clap(version = crate_version!(), author = crate_authors!())]
FromJson,
}

Expand Down
4 changes: 2 additions & 2 deletions src/bin/wbmc.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use cancel_culture::cli;
use clap::{crate_authors, crate_version, Parser};
use clap::Parser;
use std::fs::File;
use std::io::{BufRead, BufReader};

Expand Down Expand Up @@ -37,7 +37,7 @@ async fn main() -> Void {
}

#[derive(Parser)]
#[clap(name = "wbmc", version = crate_version!(), author = crate_authors!())]
#[clap(name = "wbmc", version, author)]
struct Opts {
/// Level of verbosity
#[clap(short, long, parse(from_occurrences))]
Expand Down
4 changes: 2 additions & 2 deletions src/bin/wbmd.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use cancel_culture::{cli, wbm, wbm::digest, wbm::valid};
use clap::{crate_authors, crate_version, Parser};
use clap::Parser;
use futures::StreamExt;
use std::collections::HashSet;
use std::fs::File;
Expand Down Expand Up @@ -324,7 +324,7 @@ async fn main() -> Void {
}

#[derive(Parser)]
#[clap(name = "wbmd", version = crate_version!(), author = crate_authors!())]
#[clap(name = "wbmd", version, author)]
struct Opts {
/// Level of verbosity
#[clap(short, long, parse(from_occurrences))]
Expand Down
4 changes: 2 additions & 2 deletions src/bin/wbsave.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use cancel_culture::{cli, wayback};
use clap::{crate_authors, crate_version, Parser};
use clap::Parser;
use std::io::BufRead;

type Void = Result<(), Box<dyn std::error::Error>>;
Expand Down Expand Up @@ -38,7 +38,7 @@ async fn main() -> Void {
}

#[derive(Parser)]
#[clap(version = crate_version!(), author = crate_authors!())]
#[clap(version, author)]
struct Opts {
#[clap(short = 'u', long)]
username: String,
Expand Down
4 changes: 2 additions & 2 deletions src/bin/wbsearch.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use cancel_culture::browser;
use chrono::NaiveDate;
use clap::{crate_authors, crate_version, Parser};
use clap::Parser;
use fantoccini::{elements::Element, Client, Locator};
use std::time::Duration;
use tokio::time::sleep;
Expand Down Expand Up @@ -135,7 +135,7 @@ fn mk_wayback_search_url(query: &str) -> String {
}

#[derive(Parser)]
#[clap(version = crate_version!(), author = crate_authors!())]
#[clap(version, author)]
struct Opts {
query: String,
#[clap(short, long)]
Expand Down
7 changes: 2 additions & 5 deletions src/bin/wbstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use cancel_culture::{
cli,
wayback::{cdx::Client, Item, Result, Store},
};
use clap::{crate_authors, crate_version, Parser};
use clap::Parser;
use flate2::{write::GzEncoder, Compression, GzBuilder};
use futures::StreamExt;
use std::collections::HashSet;
Expand Down Expand Up @@ -336,7 +336,7 @@ async fn main() -> Result<()> {
}

#[derive(Parser)]
#[clap(name = "wbstore", version = crate_version!(), author = crate_authors!())]
#[clap(name = "wbstore", version, author)]
struct Opts {
/// Wayback Machine store directory
#[clap(short, long, default_value = "wayback")]
Expand All @@ -353,10 +353,8 @@ struct Opts {

#[derive(Parser)]
enum SubCommand {
#[clap(version = crate_version!(), author = crate_authors!())]
Export(ExportQuery),
/// Compute digest for all files in the store's data directory
#[clap(version = crate_version!(), author = crate_authors!())]
ComputeDigests,
ComputeDigestsRaw,
Merge(MergeCommand),
Expand All @@ -365,7 +363,6 @@ enum SubCommand {
FixRedirects(FixCommand),
GuessRedirects(FixCommand),
/// Compute digest for the input from stdin
#[clap(version = crate_version!(), author = crate_authors!())]
Digest,
CheckValid(CheckValidCommand),
ListValid(CheckValidCommand),
Expand Down
4 changes: 2 additions & 2 deletions src/bin/wbtweets.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use cancel_culture::{cli, twitter::store::wayback::TweetStore, wayback::Store};
use clap::{crate_authors, crate_version, Parser};
use clap::Parser;

type Void = Result<(), Box<dyn std::error::Error>>;

Expand All @@ -19,7 +19,7 @@ async fn main() -> Void {
}

#[derive(Parser)]
#[clap(name = "wbtweets", version = crate_version!(), author = crate_authors!())]
#[clap(name = "wbtweets", version, author)]
struct Opts {
/// Wayback Machine store directory
#[clap(short, long, default_value = "wayback")]
Expand Down
4 changes: 2 additions & 2 deletions src/bin/wbvalidate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use cancel_culture::{
cli,
wayback::{cdx::Client, Store},
};
use clap::{crate_authors, crate_version, Parser};
use clap::Parser;
use flate2::{Compression, GzBuilder};
use std::fs::File;
use std::io::Write;
Expand Down Expand Up @@ -72,7 +72,7 @@ async fn main() -> Void {
}

#[derive(Parser)]
#[clap(name = "wbvalidate", version = crate_version!(), author = crate_authors!())]
#[clap(name = "wbvalidate", version, author)]
struct Opts {
/// Wayback Machine store directory
#[clap(short, long, default_value = "wayback")]
Expand Down
6 changes: 2 additions & 4 deletions src/wbm/tweet/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,7 @@ impl TweetStore {
Ok(result)
}

pub async fn for_each_interaction<
F: Fn((u64, u64, u64, String), (u64, u64, u64, String)) -> (),
>(
pub async fn for_each_interaction<F: Fn((u64, u64, u64, String), (u64, u64, u64, String))>(
&self,
twitter_id: u64,
f: F,
Expand Down Expand Up @@ -534,7 +532,7 @@ impl TweetStore {
}

let screen_name = stmt
.query_row(params![SQLiteId(*id)], |row| Ok(row.get(0)?))
.query_row(params![SQLiteId(*id)], |row| row.get(0))
.optional()?;
result.insert(*id, screen_name);
}
Expand Down
4 changes: 2 additions & 2 deletions src/wbm/tweet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ pub async fn export_tweets(store: &ValidStore, tweet_store: &db::TweetStore) ->
.try_for_each_concurrent(4, |(digest, path)| async move {
if tweet_store.check_digest(&digest).await?.is_none() {
let ts = tweet_store.clone();
let act = tokio::spawn(async move {
let act = tokio::task::spawn_local(async move {
if let Ok(Some((status_id, tweets))) = extract_tweets_from_path(path) {
ts.add_tweets(&digest, status_id, &tweets).await.unwrap()
ts.add_tweets(&digest, status_id, &tweets).await.unwrap();
}
});

Expand Down

0 comments on commit 1c662cd

Please sign in to comment.