Skip to content

Commit 6e7c902

Browse files
committed
cargo fmt
1 parent 5919ad7 commit 6e7c902

File tree

3 files changed

+23
-24
lines changed

3 files changed

+23
-24
lines changed

src/category.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ impl Category {
201201
"\
202202
SELECT COUNT(*) \
203203
FROM categories \
204-
WHERE category NOT LIKE '%::%'"
204+
WHERE category NOT LIKE '%::%'",
205205
);
206206
let count = query.get_result(&*conn)?;
207207
Ok(count)
@@ -328,7 +328,6 @@ impl<'a> NewCategory<'a> {
328328
.get_result(conn)
329329
.map_err(Into::into)
330330
}
331-
332331
}
333332

334333
impl Model for Category {
@@ -383,9 +382,10 @@ pub fn show(req: &mut Request) -> CargoResult<Response> {
383382
let id = &req.params()["category_id"];
384383
let conn = req.db_conn()?;
385384
let cat = categories.filter(slug.eq(id)).first::<Category>(&*conn)?;
386-
let subcats = cat.subcategories(&*conn)?.into_iter().map(|s| {
387-
s.encodable()
388-
}).collect();
385+
let subcats = cat.subcategories(&*conn)?
386+
.into_iter()
387+
.map(|s| s.encodable())
388+
.collect();
389389

390390
let cat = cat.encodable();
391391
let cat_with_subcats = EncodableCategoryWithSubcategories {

src/tests/category.rs

+16-18
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,12 @@ fn index() {
3535
// Create a category and a subcategory
3636
{
3737
let conn = t!(app.diesel_database.get());
38-
::new_category("foo", "foo").create_or_update(&conn).unwrap();
39-
::new_category("foo::bar", "foo::bar").create_or_update(&conn).unwrap();
38+
::new_category("foo", "foo")
39+
.create_or_update(&conn)
40+
.unwrap();
41+
::new_category("foo::bar", "foo::bar")
42+
.create_or_update(&conn)
43+
.unwrap();
4044
}
4145
let mut response = ok_resp!(middle.call(&mut req));
4246
let json: CategoryList = ::json(&mut response);
@@ -89,7 +93,11 @@ fn update_crate() {
8993
let user = t!(::new_user("foo").create_or_update(&conn));
9094
t!(::new_category("cat1", "cat1").create_or_update(&conn));
9195
t!(::new_category("Category 2", "category-2").create_or_update(&conn));
92-
t!(::new_crate("foo_crate").create_or_update(&conn, None, user.id))
96+
t!(::new_crate("foo_crate").create_or_update(
97+
&conn,
98+
None,
99+
user.id,
100+
))
93101
};
94102

95103
// Updating with no categories has no effect
@@ -127,11 +135,7 @@ fn update_crate() {
127135
// Adding 2 categories
128136
{
129137
let conn = t!(app.diesel_database.get());
130-
Category::update_crate(
131-
&conn,
132-
&krate,
133-
&["cat1", "category-2"],
134-
).unwrap();
138+
Category::update_crate(&conn, &krate, &["cat1", "category-2"]).unwrap();
135139
}
136140
assert_eq!(cnt(&mut req, "cat1"), 1);
137141
assert_eq!(cnt(&mut req, "category-2"), 1);
@@ -147,11 +151,7 @@ fn update_crate() {
147151
// Attempting to add one valid category and one invalid category
148152
let invalid_categories = {
149153
let conn = t!(app.diesel_database.get());
150-
Category::update_crate(
151-
&conn,
152-
&krate,
153-
&["cat1", "catnope"],
154-
).unwrap()
154+
Category::update_crate(&conn, &krate, &["cat1", "catnope"]).unwrap()
155155
};
156156
assert_eq!(invalid_categories, vec!["catnope".to_string()]);
157157
assert_eq!(cnt(&mut req, "cat1"), 1);
@@ -176,12 +176,10 @@ fn update_crate() {
176176
// Add a category and its subcategory
177177
{
178178
let conn = t!(app.diesel_database.get());
179-
t!(::new_category("cat1::bar", "cat1::bar").create_or_update(&conn));
180-
Category::update_crate(
179+
t!(::new_category("cat1::bar", "cat1::bar").create_or_update(
181180
&conn,
182-
&krate,
183-
&["cat1", "cat1::bar"],
184-
).unwrap();
181+
));
182+
Category::update_crate(&conn, &krate, &["cat1", "cat1::bar"]).unwrap();
185183
}
186184
assert_eq!(cnt(&mut req, "cat1"), 1);
187185
assert_eq!(cnt(&mut req, "cat1::bar"), 1);

src/tests/krate.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1714,7 +1714,8 @@ fn author_license_and_description_required() {
17141714
req.with_body(&::new_crate_to_body(&new_crate, &[]));
17151715
let json = bad_resp!(middle.call(&mut req));
17161716
assert!(
1717-
!json.errors[0].detail.contains("author") && json.errors[0].detail.contains("description") &&
1717+
!json.errors[0].detail.contains("author") &&
1718+
json.errors[0].detail.contains("description") &&
17181719
!json.errors[0].detail.contains("license"),
17191720
"{:?}",
17201721
json.errors

0 commit comments

Comments
 (0)