forge
Explore
Log in

Don't you dare go Hollow

Zero clippy/rustc warnings project-wide

Browse files at this commit

c7829873a1568c218bdb9b19060d331e67e9f5ecAhmet Kaan GümüşParent: fae1f79
  • style
    • zero clippy/rustc warnings project-wide
Show full message
🧹 style: zero clippy/rustc warnings project-wide

Box the large LoginResponse::LoggedIn variant and drop the
let-and-return in login_as_school.
src/web/auth.rsmodified+2 -2
@@ -99,7 +99,7 @@ struct SchoolChoiceResponse {
99 #[derive(Serialize, ToSchema)]99 #[derive(Serialize, ToSchema)]
100 #[serde(untagged)]100 #[serde(untagged)]
101 enum LoginResponse {101 enum LoginResponse {
102- LoggedIn(UserResponse),102+ LoggedIn(Box<UserResponse>),
103 ChooseSchool(SchoolChoiceResponse),103 ChooseSchool(SchoolChoiceResponse),
104 }104 }
105 105
@@ -296,7 +296,7 @@ async fn login(
296 );296 );
297 Ok((297 Ok((
298 jar.add(cookie),298 jar.add(cookie),
299- Json(LoginResponse::LoggedIn(UserResponse::new(&user))),299+ Json(LoginResponse::LoggedIn(Box::new(UserResponse::new(&user)))),
300 ))300 ))
301 }301 }
302 many => {302 many => {
tests/common/mod.rsmodified+2 -3
@@ -233,7 +233,7 @@ pub async fn login_as_school(
233 // The account is a person: if `username` already belongs to another233 // The account is a person: if `username` already belongs to another
234 // school, login answers a choice list and never names a school — bind234 // school, login answers a choice list and never names a school — bind
235 // the school this helper was called for.235 // the school this helper was called for.
236- let cookie = if res.body["schools"].is_array() {236+ if res.body["schools"].is_array() {
237 let selected = send(237 let selected = send(
238 app,238 app,
239 "POST",239 "POST",
@@ -251,8 +251,7 @@ pub async fn login_as_school(
251 selected.cookie.expect("school cookie after selection")251 selected.cookie.expect("school cookie after selection")
252 } else {252 } else {
253 res.cookie.expect("session cookie set on login")253 res.cookie.expect("session cookie set on login")
254- };254+ }
255- cookie
256 }255 }
257 256
258 /// Send one request through `app`. `cookie` is a raw `Cookie` header value.257 /// Send one request through `app`. `cookie` is a raw `Cookie` header value.