@@ -35,8 +35,12 @@ fn index() {
35
35
// Create a category and a subcategory
36
36
{
37
37
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 ( ) ;
40
44
}
41
45
let mut response = ok_resp ! ( middle. call( & mut req) ) ;
42
46
let json: CategoryList = :: json ( & mut response) ;
@@ -89,8 +93,7 @@ fn update_crate() {
89
93
let user = t ! ( :: new_user( "foo" ) . create_or_update( & conn) ) ;
90
94
t ! ( :: new_category( "cat1" , "cat1" ) . create_or_update( & conn) ) ;
91
95
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)
94
97
} ;
95
98
96
99
// Updating with no categories has no effect
@@ -128,11 +131,7 @@ fn update_crate() {
128
131
// Adding 2 categories
129
132
{
130
133
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 ( ) ;
136
135
}
137
136
assert_eq ! ( cnt( & mut req, "cat1" ) , 1 ) ;
138
137
assert_eq ! ( cnt( & mut req, "category-2" ) , 1 ) ;
@@ -148,11 +147,7 @@ fn update_crate() {
148
147
// Attempting to add one valid category and one invalid category
149
148
let invalid_categories = {
150
149
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 ( )
156
151
} ;
157
152
assert_eq ! ( invalid_categories, vec![ "catnope" . to_string( ) ] ) ;
158
153
assert_eq ! ( cnt( & mut req, "cat1" ) , 1 ) ;
@@ -177,12 +172,10 @@ fn update_crate() {
177
172
// Add a category and its subcategory
178
173
{
179
174
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(
182
176
& conn,
183
- & krate,
184
- & [ "cat1" , "cat1::bar" ] ,
185
- ) . unwrap ( ) ;
177
+ ) ) ;
178
+ Category :: update_crate ( & conn, & krate, & [ "cat1" , "cat1::bar" ] ) . unwrap ( ) ;
186
179
}
187
180
assert_eq ! ( cnt( & mut req, "cat1" ) , 1 ) ;
188
181
assert_eq ! ( cnt( & mut req, "cat1::bar" ) , 1 ) ;
0 commit comments