Skip to content

Commit 380a36c

Browse files
committed
cargo fmt
1 parent abe009b commit 380a36c

File tree

6 files changed

+13
-11
lines changed

6 files changed

+13
-11
lines changed

src/controllers/krate/owners.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ fn modify_owners(req: &mut dyn Request, add: bool) -> AppResult<Response> {
104104
Rights::Full => {}
105105
// Yes!
106106
Rights::Publish => {
107-
return Err(cargo_err("team members don't have permission to modify owners"));
107+
return Err(cargo_err(
108+
"team members don't have permission to modify owners",
109+
));
108110
}
109111
Rights::None => {
110112
return Err(cargo_err("only owners have permission to modify owners"));

src/github.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use serde::de::DeserializeOwned;
88
use std::str;
99

1010
use crate::app::App;
11-
use crate::util::{errors::NotFound, cargo_err, internal, AppError, AppResult};
11+
use crate::util::{cargo_err, errors::NotFound, internal, AppError, AppResult};
1212

1313
/// Does all the nonsense for sending a GET to Github. Doesn't handle parsing
1414
/// because custom error-code handling may be desirable. Use

src/models/krate.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,9 @@ impl<'a> NewCrate<'a> {
145145
}
146146

147147
// Ensure the entire URL parses as well
148-
Url::parse(url)
149-
.map_err(|_| cargo_err(&format_args!("`{}` is not a valid url: `{}`", field, url)))?;
148+
Url::parse(url).map_err(|_| {
149+
cargo_err(&format_args!("`{}` is not a valid url: `{}`", field, url))
150+
})?;
150151
Ok(())
151152
}
152153

src/models/team.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use diesel::prelude::*;
22

33
use crate::app::App;
44
use crate::github::{github_api, team_url};
5-
use crate::util::{errors::NotFound, cargo_err, AppResult};
5+
use crate::util::{cargo_err, errors::NotFound, AppResult};
66

77
use oauth2::{prelude::*, AccessToken};
88

src/publish_rate_limit.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -329,11 +329,7 @@ mod tests {
329329
Ok(user.id)
330330
}
331331

332-
fn new_user_bucket(
333-
conn: &PgConnection,
334-
tokens: i32,
335-
now: NaiveDateTime,
336-
) -> AppResult<Bucket> {
332+
fn new_user_bucket(conn: &PgConnection, tokens: i32, now: NaiveDateTime) -> AppResult<Bucket> {
337333
diesel::insert_into(publish_limit_buckets::table)
338334
.values(Bucket {
339335
user_id: new_user(conn, "new_user")?,

src/router.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,10 @@ mod tests {
207207
assert_eq!(C(|_| err(NotFound)).call(&mut req).unwrap().status.0, 404);
208208

209209
// cargo_err errors are returned as 200 so that cargo displays this nicely on the command line
210-
assert_eq!(C(|_| Err(cargo_err(""))).call(&mut req).unwrap().status.0, 200);
210+
assert_eq!(
211+
C(|_| Err(cargo_err(""))).call(&mut req).unwrap().status.0,
212+
200
213+
);
211214

212215
// All other error types are propogated up the middleware, eventually becoming status 500
213216
assert!(C(|_| Err(internal(""))).call(&mut req).is_err());

0 commit comments

Comments
 (0)