Skip to content

Commit acdc038

Browse files
committed
clippy fixes
1 parent 5cbd12f commit acdc038

File tree

10 files changed

+28
-63
lines changed

10 files changed

+28
-63
lines changed

tests/basic/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
use actix_web::{
22
body::MessageBody,
3-
http::{self, StatusCode},
3+
http::{self},
44
test,
55
};
6-
use sqlpage::webserver::http::main_handler;
76

8-
use crate::common::{get_request_to, req_path};
7+
use crate::common::req_path;
98

109
#[actix_web::test]
1110
async fn test_index_ok() {
@@ -82,4 +81,4 @@ async fn test_spaces_in_file_names() {
8281
let body = test::read_body(resp).await;
8382
let body_str = String::from_utf8(body.to_vec()).unwrap();
8483
assert!(body_str.contains("It works !"), "{body_str}");
85-
}
84+
}

tests/common/mod.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::{collections::HashMap, path::PathBuf, time::Duration};
1+
use std::time::Duration;
22

33
use actix_web::{
44
http::header::ContentType,
@@ -7,9 +7,7 @@ use actix_web::{
77
};
88
use sqlpage::{
99
app_config::{test_database_url, AppConfig},
10-
webserver::{
11-
http::{form_config, main_handler, payload_config},
12-
},
10+
webserver::http::{form_config, main_handler, payload_config},
1311
AppState,
1412
};
1513

@@ -101,4 +99,4 @@ pub fn init_log() {
10199
.parse_default_env()
102100
.is_test(true)
103101
.try_init();
104-
}
102+
}

tests/components/mod.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
use actix_web::{
2-
http::StatusCode,
3-
test,
4-
};
1+
use actix_web::{http::StatusCode, test};
52
use sqlpage::webserver::http::main_handler;
63

74
use crate::common::get_request_to;
@@ -25,4 +22,4 @@ async fn test_overwrite_variable() -> actix_web::Result<()> {
2522
"{body_str}\nexpected to contain: It works !"
2623
);
2724
Ok(())
28-
}
25+
}

tests/core/mod.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
use actix_web::{
2-
http::{self, StatusCode},
2+
http::StatusCode,
33
test,
44
};
5-
use sqlpage::{
6-
webserver,
7-
AppState,
8-
};
5+
use sqlpage::{webserver, AppState};
96
use sqlx::Executor as _;
107

118
use crate::common::{make_app_data_from_config, req_path, req_path_with_app_data, test_config};
@@ -53,7 +50,8 @@ async fn test_routing_with_db_fs() {
5350
config.site_prefix = "/prefix/".to_string();
5451
let state = AppState::init(&config).await.unwrap();
5552

56-
let create_table_sql = sqlpage::filesystem::DbFsQueries::get_create_table_sql(state.db.connection.any_kind());
53+
let create_table_sql =
54+
sqlpage::filesystem::DbFsQueries::get_create_table_sql(state.db.connection.any_kind());
5755
state
5856
.db
5957
.connection
@@ -144,11 +142,9 @@ async fn test_hidden_files() {
144142
assert_eq!(resp.status(), StatusCode::FORBIDDEN);
145143
let srv_resp = actix_web::test::TestRequest::default().to_srv_response(resp);
146144
let body = test::read_body(srv_resp).await;
147-
assert!(
148-
String::from_utf8_lossy(&body)
149-
.to_lowercase()
150-
.contains("forbidden"),
151-
);
145+
assert!(String::from_utf8_lossy(&body)
146+
.to_lowercase()
147+
.contains("forbidden"),);
152148
}
153149

154150
#[actix_web::test]
@@ -196,4 +192,4 @@ async fn make_app_data_for_official_website() -> actix_web::web::Data<AppState>
196192
.await
197193
.unwrap();
198194
app_state
199-
}
195+
}

tests/data_formats/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,4 @@ async fn test_json_columns() {
7979
!body_html_escaped.contains("{"),
8080
"the json should have been parsed, not returned as a string, in: {body_html_escaped}"
8181
);
82-
}
82+
}

tests/errors/mod.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
use actix_web::{
2-
http::StatusCode,
3-
test,
4-
};
5-
use sqlpage::webserver::http::main_handler;
1+
use actix_web::{http::StatusCode, test};
62

73
use crate::common::req_path;
84

@@ -17,9 +13,7 @@ async fn test_privileged_paths_are_not_accessible() {
1713
assert_eq!(resp.status(), StatusCode::FORBIDDEN);
1814
let srv_resp = actix_web::test::TestRequest::default().to_srv_response(resp);
1915
let body = test::read_body(srv_resp).await;
20-
assert!(
21-
String::from_utf8_lossy(&body)
22-
.to_lowercase()
23-
.contains("forbidden"),
24-
);
25-
}
16+
assert!(String::from_utf8_lossy(&body)
17+
.to_lowercase()
18+
.contains("forbidden"),);
19+
}

tests/mod.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,3 @@ mod errors;
77
mod requests;
88
mod transactions;
99
mod uploads;
10-
11-
pub use basic::*;
12-
pub use common::*;
13-
pub use components::*;
14-
pub use core::*;
15-
pub use data_formats::*;
16-
pub use errors::*;
17-
pub use requests::*;
18-
pub use transactions::*;
19-
pub use uploads::*;

tests/requests/mod.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
use actix_web::{
2-
http::StatusCode,
3-
test,
4-
};
1+
use actix_web::{http::StatusCode, test};
52
use sqlpage::webserver::http::main_handler;
63

74
use crate::common::get_request_to;
@@ -101,4 +98,4 @@ async fn test_large_form_field_roundtrip() -> actix_web::Result<()> {
10198
"{body_str}\nexpected to contain long string submitted"
10299
);
103100
Ok(())
104-
}
101+
}

tests/transactions/mod.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
use actix_web::{
2-
http::StatusCode,
3-
test,
4-
};
1+
use actix_web::{http::StatusCode, test};
52
use sqlpage::webserver::http::main_handler;
63

74
use crate::common::{get_request_to_with_data, make_app_data};
@@ -97,4 +94,4 @@ async fn test_failed_copy_followed_by_query() -> actix_web::Result<()> {
9794
);
9895
}
9996
Ok(())
100-
}
97+
}

tests/uploads/mod.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
use actix_web::{
2-
http::StatusCode,
3-
test,
4-
};
1+
use actix_web::{http::StatusCode, test};
52
use sqlpage::webserver::http::main_handler;
63

74
use crate::common::get_request_to;
@@ -165,4 +162,4 @@ async fn test_csv_upload() -> actix_web::Result<()> {
165162
"{body_str}\nexpected to contain: Ophir is 29 years old"
166163
);
167164
Ok(())
168-
}
165+
}

0 commit comments

Comments
 (0)