Skip to content

Commit 4f72d1e

Browse files
committed
fmt
1 parent ab59dd2 commit 4f72d1e

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

src/webserver/database/sqlpage_functions/functions.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ super::function_definition_macro::sqlpage_functions! {
3636
version();
3737
}
3838

39-
4039
/// Returns the password from the HTTP basic auth header, if present.
4140
async fn basic_auth_password(request: &RequestInfo) -> anyhow::Result<&str> {
4241
let password = extract_basic_auth(request)?.password().ok_or_else(|| {
@@ -117,8 +116,9 @@ async fn exec<'a>(
117116
Ok(String::from_utf8_lossy(&res.stdout).into_owned())
118117
}
119118

120-
121-
async fn fetch(http_request: super::http_fetch_request::HttpFetchRequest<'_>) -> anyhow::Result<String> {
119+
async fn fetch(
120+
http_request: super::http_fetch_request::HttpFetchRequest<'_>,
121+
) -> anyhow::Result<String> {
122122
use awc::http::Method;
123123
let client = awc::Client::builder()
124124
.add_default_header((awc::http::header::USER_AGENT, env!("CARGO_PKG_NAME")))
@@ -175,13 +175,11 @@ async fn header<'a>(request: &'a RequestInfo, name: Cow<'a, str>) -> Option<Cow<
175175
request.headers.get(&*name).map(SingleOrVec::as_json_str)
176176
}
177177

178-
179178
/// Returns the path component of the URL of the current request.
180179
async fn path(request: &RequestInfo) -> &str {
181180
&request.path
182181
}
183182

184-
185183
const DEFAULT_ALLOWED_EXTENSIONS: &str =
186184
"jpg,jpeg,png,gif,bmp,webp,pdf,txt,doc,docx,xls,xlsx,csv,mp3,mp4,wav,avi,mov";
187185

@@ -259,14 +257,12 @@ pub(crate) fn random_string_sync(len: usize) -> String {
259257
.collect()
260258
}
261259

262-
263260
#[tokio::test]
264261
async fn test_random_string() {
265262
let s = random_string(10).await.unwrap();
266263
assert_eq!(s.len(), 10);
267264
}
268265

269-
270266
async fn read_file_bytes<'a>(
271267
request: &'a RequestInfo,
272268
path_str: &str,
@@ -287,7 +283,6 @@ async fn read_file_bytes<'a>(
287283
}
288284
}
289285

290-
291286
async fn read_file_as_data_url<'a>(
292287
request: &'a RequestInfo,
293288
file_path: Option<Cow<'a, str>>,
@@ -393,7 +388,6 @@ async fn run_sql<'a>(
393388
Ok(Some(Cow::Owned(String::from_utf8(json_results_bytes)?)))
394389
}
395390

396-
397391
#[tokio::test]
398392
async fn test_hash_password() {
399393
let s = hash_password("password".to_string()).await.unwrap();
@@ -420,7 +414,6 @@ async fn uploaded_file_path<'a>(
420414
Some(uploaded_file.file.path().to_string_lossy())
421415
}
422416

423-
424417
/// escapes a string for use in a URL using percent encoding
425418
/// for example, spaces are replaced with %20, '/' with %2F, etc.
426419
/// This is useful for constructing URLs in SQL queries.
@@ -478,4 +471,4 @@ async fn variables<'a>(
478471
/// Returns the version of the sqlpage that is running.
479472
async fn version() -> &'static str {
480473
env!("CARGO_PKG_VERSION")
481-
}
474+
}

src/webserver/database/sqlpage_functions/http_fetch_request.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ impl<'a> BorrowFromStr<'a> for HttpFetchRequest<'a> {
5454
} else {
5555
match s {
5656
Cow::Borrowed(s) => serde_json::from_str(s)?,
57-
Cow::Owned(s) => serde_json::from_str::<HttpFetchRequest<'_>>(&s).map(HttpFetchRequest::into_owned)?,
57+
Cow::Owned(s) => serde_json::from_str::<HttpFetchRequest<'_>>(&s)
58+
.map(HttpFetchRequest::into_owned)?,
5859
}
5960
})
6061
}

0 commit comments

Comments
 (0)