diff options
author | Kjetil Orbekk <kj@orbekk.com> | 2023-01-01 20:47:59 -0500 |
---|---|---|
committer | Kjetil Orbekk <kj@orbekk.com> | 2023-01-01 20:50:11 -0500 |
commit | 33dfcd18252dd8a4845cd58b93bd177ab0dffde9 (patch) | |
tree | fbb6fc049677a492cd9d5196d6b1709f0b32b873 /server/src | |
parent | d3fbefad9cf25786fb5f28f96eeceb65d0a8b35b (diff) |
Fix clippy warnings
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/auth.rs | 8 | ||||
-rw-r--r-- | server/src/error.rs | 6 | ||||
-rw-r--r-- | server/src/fake_auth.rs | 6 | ||||
-rw-r--r-- | server/src/play.rs | 5 |
4 files changed, 17 insertions, 8 deletions
diff --git a/server/src/auth.rs b/server/src/auth.rs index 76b16cf..173a2b3 100644 --- a/server/src/auth.rs +++ b/server/src/auth.rs @@ -96,6 +96,12 @@ impl SessionId { } } +impl Default for SessionId { + fn default() -> Self { + Self::new() + } +} + impl ToString for SessionId { fn to_string(&self) -> String { self.0.to_string() @@ -116,7 +122,7 @@ fn token_safe_time() -> chrono::Duration { chrono::Duration::seconds(30) } -pub const LOGIN_CALLBACK: &'static str = "/api/login_callback"; +pub const LOGIN_CALLBACK: &str = "/api/login_callback"; fn redirect_url(app_url: &str) -> RedirectUrl { RedirectUrl::new(format!("{}{}", app_url, LOGIN_CALLBACK)).unwrap() } diff --git a/server/src/error.rs b/server/src/error.rs index 7eb5fa2..ebe1d93 100644 --- a/server/src/error.rs +++ b/server/src/error.rs @@ -70,12 +70,12 @@ impl BridgeError { pub fn as_rejection(&self) -> (http::StatusCode, String) { match self { BridgeError::NotLoggedIn => { - (StatusCode::UNAUTHORIZED, format!("Must be logged in")) + (StatusCode::UNAUTHORIZED, "Must be logged in".to_string()) } BridgeError::OpenidRequestTokenError(_) => { - (StatusCode::UNAUTHORIZED, format!("Error fetching token")) + (StatusCode::UNAUTHORIZED, "Error fetching token".to_string()) } - _ => (StatusCode::INTERNAL_SERVER_ERROR, format!("Error: {self}")), + _ => (StatusCode::INTERNAL_SERVER_ERROR, "Error: {self}".to_string()), } } } diff --git a/server/src/fake_auth.rs b/server/src/fake_auth.rs index 6a3ff2c..caea745 100644 --- a/server/src/fake_auth.rs +++ b/server/src/fake_auth.rs @@ -29,6 +29,12 @@ impl FakeAuthenticator { } } +impl Default for FakeAuthenticator { + fn default() -> Self { + Self::new() + } +} + #[async_trait] impl Authenticator for FakeAuthenticator { async fn user_info( diff --git a/server/src/play.rs b/server/src/play.rs index 893cb95..f413a74 100644 --- a/server/src/play.rs +++ b/server/src/play.rs @@ -141,10 +141,7 @@ impl<J: Journal<TableUpdate>> Table<J> { } pub fn game_in_progress(&self) -> bool { - match &self.state { - TableState::Game(_) => true, - _ => false, - } + matches!(&self.state, TableState::Game(_)) } pub fn game(&self) -> Result<&GameState, BridgeError> { |