Skip to content

Commit 60fe8ed

Browse files
jtgeibelcarols10cents
authored andcommitted
cargo fmt
1 parent 2afe32e commit 60fe8ed

File tree

2 files changed

+17
-23
lines changed

2 files changed

+17
-23
lines changed

src/category.rs

+5-4
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)
@@ -366,9 +366,10 @@ pub fn show(req: &mut Request) -> CargoResult<Response> {
366366
let id = &req.params()["category_id"];
367367
let conn = req.db_conn()?;
368368
let cat = categories.filter(slug.eq(id)).first::<Category>(&*conn)?;
369-
let subcats = cat.subcategories(&*conn)?.into_iter().map(|s| {
370-
s.encodable()
371-
}).collect();
369+
let subcats = cat.subcategories(&*conn)?
370+
.into_iter()
371+
.map(|s| s.encodable())
372+
.collect();
372373

373374
let cat = cat.encodable();
374375
let cat_with_subcats = EncodableCategoryWithSubcategories {

src/tests/category.rs

+12-19
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,8 +93,7 @@ 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-
::CrateBuilder::new("foo_crate", user.id)
93-
.expect_build(&conn)
96+
::CrateBuilder::new("foo_crate", user.id).expect_build(&conn)
9497
};
9598

9699
// Updating with no categories has no effect
@@ -128,11 +131,7 @@ fn update_crate() {
128131
// Adding 2 categories
129132
{
130133
let conn = t!(app.diesel_database.get());
131-
Category::update_crate(
132-
&conn,
133-
&krate,
134-
&["cat1", "category-2"],
135-
).unwrap();
134+
Category::update_crate(&conn, &krate, &["cat1", "category-2"]).unwrap();
136135
}
137136
assert_eq!(cnt(&mut req, "cat1"), 1);
138137
assert_eq!(cnt(&mut req, "category-2"), 1);
@@ -148,11 +147,7 @@ fn update_crate() {
148147
// Attempting to add one valid category and one invalid category
149148
let invalid_categories = {
150149
let conn = t!(app.diesel_database.get());
151-
Category::update_crate(
152-
&conn,
153-
&krate,
154-
&["cat1", "catnope"],
155-
).unwrap()
150+
Category::update_crate(&conn, &krate, &["cat1", "catnope"]).unwrap()
156151
};
157152
assert_eq!(invalid_categories, vec!["catnope".to_string()]);
158153
assert_eq!(cnt(&mut req, "cat1"), 1);
@@ -177,12 +172,10 @@ fn update_crate() {
177172
// Add a category and its subcategory
178173
{
179174
let conn = t!(app.diesel_database.get());
180-
t!(::new_category("cat1::bar", "cat1::bar").create_or_update(&conn));
181-
Category::update_crate(
175+
t!(::new_category("cat1::bar", "cat1::bar").create_or_update(
182176
&conn,
183-
&krate,
184-
&["cat1", "cat1::bar"],
185-
).unwrap();
177+
));
178+
Category::update_crate(&conn, &krate, &["cat1", "cat1::bar"]).unwrap();
186179
}
187180
assert_eq!(cnt(&mut req, "cat1"), 1);
188181
assert_eq!(cnt(&mut req, "cat1::bar"), 1);

0 commit comments

Comments
 (0)