Conversation
Improvements: - Remove unnecessary braces in imports - Remove redundant type annotations throughout - Use derive(Clone) instead of manual implementation for Claims - Remove async from jwt_valid (no await needed) - Remove debug println! statements from production code - Fix logout() to return proper error instead of panicking - Add LogoutError type for missing bearer token - Add DbError enum for database operation errors - Make insert/update return Result to handle serialization errors - Use impl Into<String> for flexible API in filter methods - Add set_bearer_token() method for cleaner token setting - Rename structs for clarity (Password -> Credentials) - Use &str in request structs with serde for efficiency - Add helper method add_filter() to reduce code duplication - Improve doc comments with proper /// format - Use modern Rust patterns (let-else, format string interpolation) - Add more comprehensive tests Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
impl Into<String>patternsChanges
Error Handling
LogoutErrortype - logout now returnsResultinstead of panicking on missing tokenDbErrorenum for database operations withSerializationandRequestvariantsinsert()andupdate()now returnResultto handle serialization errorsCode Quality
use reqwest::{Client}→use reqwest::Client)#[derive(Clone)]instead of manual implementation forClaimsasyncfromjwt_valid()(no await needed)println!statements from production codePasswordstruct toCredentialsfor clarity&strin request structs with serde for efficiencyadd_filter()to reduce code duplicationAPI Improvements
set_bearer_token()method for cleaner token settingimpl Into<String>for flexibilityin_()method now accepts anyIntoIteratorof string-like valuesModern Rust Patterns
let Some(x) = ... else { return }){e}instead of{}, e)///formatTests
test_client_creationwith explicit valuestest_set_bearer_tokentest_logout_requires_bearer_tokentest_db_error_display