Skip to content

Commit 9c48f03

Browse files
committed
Fixed clippy warnings
1 parent 8068f31 commit 9c48f03

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/gdpr.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ pub fn create_consent_cookie(consent: &GdprConsent) -> String {
6464
}
6565

6666
pub fn handle_consent_request(_settings: &Settings, req: Request) -> Result<Response, Error> {
67-
match req.get_method() {
68-
&Method::GET => {
67+
match *req.get_method() {
68+
Method::GET => {
6969
// Return current consent status
7070
let consent = get_consent_from_request(&req).unwrap_or_default();
7171
Ok(Response::from_status(StatusCode::OK)
7272
.with_header(header::CONTENT_TYPE, "application/json")
7373
.with_body(serde_json::to_string(&consent)?))
7474
}
75-
&Method::POST => {
75+
Method::POST => {
7676
// Update consent preferences
7777
let consent: GdprConsent = serde_json::from_slice(req.into_body_bytes().as_slice())?;
7878
let mut response = Response::from_status(StatusCode::OK)
@@ -90,8 +90,8 @@ pub fn handle_consent_request(_settings: &Settings, req: Request) -> Result<Resp
9090
}
9191

9292
pub fn handle_data_subject_request(_settings: &Settings, req: Request) -> Result<Response, Error> {
93-
match req.get_method() {
94-
&Method::GET => {
93+
match *req.get_method() {
94+
Method::GET => {
9595
// Handle data access request
9696
if let Some(synthetic_id) = req.get_header("X-Subject-ID") {
9797
// Create a HashMap to store all user-related data
@@ -108,7 +108,7 @@ pub fn handle_data_subject_request(_settings: &Settings, req: Request) -> Result
108108
Ok(Response::from_status(StatusCode::BAD_REQUEST).with_body("Missing subject ID"))
109109
}
110110
}
111-
&Method::DELETE => {
111+
Method::DELETE => {
112112
// Handle right to erasure (right to be forgotten)
113113
if let Some(_synthetic_id) = req.get_header("X-Subject-ID") {
114114
// TODO: Implement data deletion from KV store

src/main.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -250,19 +250,19 @@ fn handle_ad_request(settings: &Settings, mut req: Request) -> Result<Response,
250250
println!("Fetching current count for synthetic ID: {}", synthetic_id);
251251
let current_count: i32 = store
252252
.lookup(&synthetic_id)
253-
.and_then(|mut val| match String::from_utf8(val.take_body_bytes()) {
253+
.map(|mut val| match String::from_utf8(val.take_body_bytes()) {
254254
Ok(s) => {
255255
println!("Value from KV store: {}", s);
256-
Ok(Some(s))
256+
Some(s)
257257
}
258258
Err(e) => {
259259
println!("Error converting bytes to string: {}", e);
260-
Ok(None)
260+
None
261261
}
262262
})
263-
.and_then(|opt_s| {
263+
.map(|opt_s| {
264264
println!("Parsing string value: {:?}", opt_s);
265-
Ok(opt_s.and_then(|s| s.parse().ok()))
265+
opt_s.and_then(|s| s.parse().ok())
266266
})
267267
.unwrap_or_else(|_| {
268268
println!("No existing count found, starting at 0");

0 commit comments

Comments
 (0)