-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace deprecated 'failure' crate with 'anyhow'
- Loading branch information
1 parent
6dcae1a
commit c2a5379
Showing
12 changed files
with
57 additions
and
89 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,10 +5,10 @@ authors = ["Alex Crichton <[email protected]>", "Pietro Albini <pietro@pietr | |
edition = '2018' | ||
|
||
[dependencies] | ||
anyhow = { version = "1", features = ["backtrace"] } | ||
base64 = "0.13.0" | ||
dialoguer = "0.10.1" | ||
env_logger = { version = "0.9.0", default-features = false } | ||
failure = "0.1" | ||
indexmap = "1.0.2" | ||
log = "0.4" | ||
rayon = "1.5" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ const USER_AGENT: &str = "https://github.com/rust-lang/team ([email protected] | |
use data::Data; | ||
use schema::{Email, Team, TeamKind}; | ||
|
||
use failure::{err_msg, Error}; | ||
use anyhow::{bail, format_err, Error}; | ||
use log::{error, info, warn}; | ||
use std::{collections::HashMap, path::PathBuf}; | ||
use structopt::StructOpt; | ||
|
@@ -105,10 +105,7 @@ fn main() { | |
env.init(); | ||
|
||
if let Err(e) = run() { | ||
error!("{}", e); | ||
for e in e.iter_causes() { | ||
error!("cause: {}", e); | ||
} | ||
error!("{:?}", e); | ||
std::process::exit(1); | ||
} | ||
} | ||
|
@@ -141,7 +138,7 @@ fn run() -> Result<(), Error> { | |
let github_id = user.id; | ||
|
||
if data.person(&github_name).is_some() { | ||
failure::bail!("person already in the repo: {}", github_name); | ||
bail!("person already in the repo: {}", github_name); | ||
} | ||
|
||
let file = format!("people/{}.toml", github_name); | ||
|
@@ -198,7 +195,7 @@ fn run() -> Result<(), Error> { | |
let github = github::GitHubApi::new(); | ||
let repo = match github.repo(&org, &name)? { | ||
Some(r) => r, | ||
None => failure::bail!("The repo '{}/{}' was not found on GitHub", org, name), | ||
None => bail!("The repo '{}/{}' was not found on GitHub", org, name), | ||
}; | ||
let mut teams = HashMap::new(); | ||
let mut bots = Vec::new(); | ||
|
@@ -263,7 +260,7 @@ fn run() -> Result<(), Error> { | |
} => { | ||
let person = data | ||
.person(github_username) | ||
.ok_or_else(|| err_msg("unknown person"))?; | ||
.ok_or_else(|| format_err!("unknown person"))?; | ||
|
||
println!("-- {} --", person.name()); | ||
println!(); | ||
|
@@ -366,11 +363,13 @@ fn run() -> Result<(), Error> { | |
} | ||
|
||
Cli::DumpTeam { ref name } => { | ||
let team = data.team(name).ok_or_else(|| err_msg("unknown team"))?; | ||
let team = data.team(name).ok_or_else(|| format_err!("unknown team"))?; | ||
dump_team_members(team, &data, false, 0)?; | ||
} | ||
Cli::DumpList { ref name } => { | ||
let list = data.list(name)?.ok_or_else(|| err_msg("unknown list"))?; | ||
let list = data | ||
.list(name)? | ||
.ok_or_else(|| format_err!("unknown list"))?; | ||
let mut emails = list.emails().iter().collect::<Vec<_>>(); | ||
emails.sort(); | ||
for email in emails { | ||
|
@@ -397,7 +396,7 @@ fn run() -> Result<(), Error> { | |
} | ||
Cli::DumpPermission { ref name } => { | ||
if !crate::schema::Permissions::available(data.config()).contains(name) { | ||
failure::bail!("unknown permission: {}", name); | ||
bail!("unknown permission: {}", name); | ||
} | ||
let mut allowed = crate::permissions::allowed_people(&data, name)? | ||
.into_iter() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.