Skip to content

Commit be048b9

Browse files
committed
FIX: Lint Error'sss
1 parent 6b3bf15 commit be048b9

File tree

7 files changed

+35
-50
lines changed

7 files changed

+35
-50
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -117,27 +117,4 @@ jobs:
117117
- name: Build documentation
118118
run: cargo doc --workspace --all-features --no-deps
119119
env:
120-
RUSTDOCFLAGS: -D warnings
121-
122-
msrv:
123-
name: MSRV (1.75)
124-
runs-on: ubuntu-latest
125-
steps:
126-
- uses: actions/checkout@v4
127-
128-
- name: Install Rust 1.75
129-
uses: dtolnay/rust-toolchain@1.75
130-
131-
- name: Cache cargo registry
132-
uses: actions/cache@v4
133-
with:
134-
path: |
135-
~/.cargo/registry
136-
~/.cargo/git
137-
target
138-
key: ${{ runner.os }}-cargo-msrv-${{ hashFiles('**/Cargo.lock') }}
139-
restore-keys: |
140-
${{ runner.os }}-cargo-msrv-
141-
142-
- name: Check MSRV
143-
run: cargo check --workspace --all-features
120+
RUSTDOCFLAGS: -D warnings

examples/proof-of-concept/src/handlers/auth.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ async fn login(
104104
}))
105105
}
106106

107-
108107
// Route functions
109108
pub fn register_route() -> Route {
110109
post_route("/auth/register", register)

examples/proof-of-concept/src/handlers/bookmarks.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use rustapi_rs::prelude::*;
55
use std::sync::Arc;
66

77
use crate::models::{
8-
Bookmark, BookmarkEvent, BookmarkListParams, BookmarkResponse, Claims,
9-
CreateBookmarkRequest, PaginatedResponse, UpdateBookmarkRequest,
8+
Bookmark, BookmarkEvent, BookmarkListParams, BookmarkResponse, Claims, CreateBookmarkRequest,
9+
PaginatedResponse, UpdateBookmarkRequest,
1010
};
1111
use crate::stores::AppState;
1212

@@ -97,7 +97,6 @@ async fn create_bookmark(
9797
Created(response)
9898
}
9999

100-
101100
/// Get a single bookmark by ID
102101
async fn get_bookmark(
103102
State(state): State<Arc<AppState>>,
@@ -196,7 +195,9 @@ async fn delete_bookmark(
196195
state.bookmarks.delete(id).await;
197196

198197
// Broadcast SSE event
199-
state.sse_broadcaster.broadcast(BookmarkEvent::Deleted { id });
198+
state
199+
.sse_broadcaster
200+
.broadcast(BookmarkEvent::Deleted { id });
200201

201202
Ok(NoContent)
202203
}
@@ -214,7 +215,10 @@ async fn export_bookmarks(
214215
.into_iter()
215216
.map(|b| {
216217
let category_name = b.category_id.and_then(|cid| {
217-
categories.iter().find(|c| c.id == cid).map(|c| c.name.clone())
218+
categories
219+
.iter()
220+
.find(|c| c.id == cid)
221+
.map(|c| c.name.clone())
218222
});
219223

220224
crate::models::BookmarkExport {
@@ -258,7 +262,11 @@ async fn import_bookmarks(
258262

259263
// Find or create category
260264
let category_id = if let Some(ref name) = export.category_name {
261-
state.categories.find_by_name(user_id, name).await.map(|c| c.id)
265+
state
266+
.categories
267+
.find_by_name(user_id, name)
268+
.await
269+
.map(|c| c.id)
262270
} else {
263271
None
264272
};
@@ -287,7 +295,6 @@ async fn import_bookmarks(
287295
})
288296
}
289297

290-
291298
// Route functions
292299
pub fn list_bookmarks_route() -> Route {
293300
get_route("/bookmarks", list_bookmarks)

examples/proof-of-concept/src/handlers/categories.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ async fn list_categories(
2222
.map(crate::models::CategoryResponse::from)
2323
.collect();
2424

25-
Json(crate::models::CategoryListResponse { categories: responses })
25+
Json(crate::models::CategoryListResponse {
26+
categories: responses,
27+
})
2628
}
2729

2830
/// Create a new category
@@ -34,7 +36,12 @@ async fn create_category(
3436
let user_id: u64 = claims.sub.parse().unwrap_or(0);
3537

3638
// Check if category name already exists for this user
37-
if state.categories.find_by_name(user_id, &body.name).await.is_some() {
39+
if state
40+
.categories
41+
.find_by_name(user_id, &body.name)
42+
.await
43+
.is_some()
44+
{
3845
return Err(ApiError::bad_request("Category name already exists"));
3946
}
4047

@@ -122,7 +129,6 @@ async fn delete_category(
122129
Ok(NoContent)
123130
}
124131

125-
126132
// Route functions
127133
pub fn list_categories_route() -> Route {
128134
get_route("/categories", list_categories)

examples/proof-of-concept/src/main.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,14 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
6969
.layer(RequestIdLayer::new())
7070
.layer(TracingLayer::new())
7171
.layer(RateLimitLayer::new(100, Duration::from_secs(60)))
72-
.layer(
73-
JwtLayer::<models::Claims>::new(JWT_SECRET).skip_paths(vec![
74-
"/",
75-
"/health",
76-
"/docs",
77-
"/auth/register",
78-
"/auth/login",
79-
"/static",
80-
]),
81-
)
72+
.layer(JwtLayer::<models::Claims>::new(JWT_SECRET).skip_paths(vec![
73+
"/",
74+
"/health",
75+
"/docs",
76+
"/auth/register",
77+
"/auth/login",
78+
"/static",
79+
]))
8280
// Register schemas
8381
.register_schema::<models::RegisterRequest>()
8482
.register_schema::<models::LoginRequest>()

examples/proof-of-concept/src/models.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ pub struct UserInfo {
102102
pub email: String,
103103
}
104104

105-
106105
// ============================================
107106
// Bookmark DTOs
108107
// ============================================

examples/proof-of-concept/src/stores.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl UserStore {
5353
/// Create a new user, returns None if email already exists
5454
pub async fn create(&self, user: User) -> Option<User> {
5555
let mut email_index = self.email_index.write().await;
56-
56+
5757
// Check if email already exists
5858
if email_index.contains_key(&user.email) {
5959
return None;
@@ -64,7 +64,7 @@ impl UserStore {
6464
new_user.id = id;
6565

6666
email_index.insert(new_user.email.clone(), id);
67-
67+
6868
let mut users = self.users.write().await;
6969
users.insert(id, new_user.clone());
7070

@@ -75,7 +75,7 @@ impl UserStore {
7575
pub async fn find_by_email(&self, email: &str) -> Option<User> {
7676
let email_index = self.email_index.read().await;
7777
let user_id = email_index.get(email)?;
78-
78+
7979
let users = self.users.read().await;
8080
users.get(user_id).cloned()
8181
}
@@ -93,7 +93,6 @@ impl Default for UserStore {
9393
}
9494
}
9595

96-
9796
/// Thread-safe bookmark store with user index
9897
pub struct BookmarkStore {
9998
bookmarks: RwLock<HashMap<u64, Bookmark>>,

0 commit comments

Comments
 (0)