Clippy
This commit is contained in:
parent
ff242af2ee
commit
0fbe26deab
|
@ -149,22 +149,22 @@ impl Connection {
|
|||
|
||||
fn thumbnail_url(&self, size: u16, file: &str, extension: Extension) -> String {
|
||||
let mut url = self.upstream.clone();
|
||||
url.set_path(&format!("/image/process.{}", extension));
|
||||
url.set_query(Some(&format!("src={}&resize={}", file, size)));
|
||||
url.set_path(&format!("/image/process.{extension}"));
|
||||
url.set_query(Some(&format!("src={file}&resize={size}")));
|
||||
|
||||
url.to_string()
|
||||
}
|
||||
|
||||
fn image_url(&self, file: &str) -> String {
|
||||
let mut url = self.upstream.clone();
|
||||
url.set_path(&format!("/image/original/{}", file,));
|
||||
url.set_path(&format!("/image/original/{file}"));
|
||||
|
||||
url.to_string()
|
||||
}
|
||||
|
||||
fn delete_url(&self, file: &str, token: &str) -> String {
|
||||
let mut url = self.upstream.clone();
|
||||
url.set_path(&format!("/image/delete/{}/{}", token, file));
|
||||
url.set_path(&format!("/image/delete/{token}/{file}"));
|
||||
|
||||
url.to_string()
|
||||
}
|
||||
|
|
50
src/lib.rs
50
src/lib.rs
|
@ -163,9 +163,9 @@ impl State {
|
|||
} else if s.is_empty() {
|
||||
self.scope.clone()
|
||||
} else if self.scope.is_empty() {
|
||||
format!("/{}", s)
|
||||
format!("/{s}")
|
||||
} else {
|
||||
format!("{}/{}", self.scope, s)
|
||||
format!("{}/{s}", self.scope)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,37 +174,31 @@ impl State {
|
|||
}
|
||||
|
||||
fn edit_collection_path(&self, id: Uuid, token: &ValidToken) -> String {
|
||||
self.scoped(&format!("{}?token={}", id, token.token))
|
||||
self.scoped(&format!("{id}?token={}", token.token))
|
||||
}
|
||||
|
||||
fn update_collection_path(&self, id: Uuid, token: &ValidToken) -> String {
|
||||
self.scoped(&format!("{}?token={}", id, token.token))
|
||||
self.scoped(&format!("{id}?token={}", token.token))
|
||||
}
|
||||
|
||||
fn delete_collection_path(&self, id: Uuid, token: &ValidToken, confirmed: bool) -> String {
|
||||
if confirmed {
|
||||
self.scoped(&format!(
|
||||
"{}/delete?token={}&confirmed=true",
|
||||
id, token.token
|
||||
))
|
||||
self.scoped(&format!("{id}/delete?token={}&confirmed=true", token.token))
|
||||
} else {
|
||||
self.scoped(&format!("{}/delete?token={}", id, token.token))
|
||||
self.scoped(&format!("{id}/delete?token={}", token.token))
|
||||
}
|
||||
}
|
||||
|
||||
fn public_collection_path(&self, id: Uuid) -> String {
|
||||
self.scoped(&format!("{}", id))
|
||||
self.scoped(&format!("{id}"))
|
||||
}
|
||||
|
||||
fn create_entry_path(&self, collection_id: Uuid, token: &ValidToken) -> String {
|
||||
self.scoped(&format!("{}/entry?token={}", collection_id, token.token))
|
||||
self.scoped(&format!("{collection_id}/entry?token={}", token.token))
|
||||
}
|
||||
|
||||
fn update_entry_path(&self, collection_id: Uuid, id: Uuid, token: &ValidToken) -> String {
|
||||
self.scoped(&format!(
|
||||
"{}/entry/{}?token={}",
|
||||
collection_id, id, token.token
|
||||
))
|
||||
self.scoped(&format!("{collection_id}/entry/{id}?token={}", token.token))
|
||||
}
|
||||
|
||||
fn move_entry_path(
|
||||
|
@ -215,8 +209,8 @@ impl State {
|
|||
direction: Direction,
|
||||
) -> String {
|
||||
self.scoped(&format!(
|
||||
"{}/entry/{}/move/{}?token={}",
|
||||
collection_id, id, direction, token.token
|
||||
"{collection_id}/entry/{id}/move/{direction}?token={}",
|
||||
token.token
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -229,25 +223,24 @@ impl State {
|
|||
) -> String {
|
||||
if confirmed {
|
||||
self.scoped(&format!(
|
||||
"{}/entry/{}/delete?token={}&confirmed=true",
|
||||
collection_id, id, token.token
|
||||
"{collection_id}/entry/{id}/delete?token={}&confirmed=true",
|
||||
token.token
|
||||
))
|
||||
} else {
|
||||
self.scoped(&format!(
|
||||
"{}/entry/{}/delete?token={}",
|
||||
collection_id, id, token.token
|
||||
"{collection_id}/entry/{id}/delete?token={}",
|
||||
token.token
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn statics_path(&self, file: &str) -> String {
|
||||
self.scoped(&format!("static/{}", file))
|
||||
self.scoped(&format!("static/{file}"))
|
||||
}
|
||||
|
||||
fn thumbnail_path(&self, filename: &str, size: u16, extension: pict::Extension) -> String {
|
||||
self.scoped(&format!(
|
||||
"image/thumbnail.{}?src={}&size={}",
|
||||
extension, filename, size
|
||||
"image/thumbnail.{extension}?src={filename}&size={size}",
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -256,9 +249,8 @@ impl State {
|
|||
|
||||
for size in connection::VALID_SIZES {
|
||||
sizes.push(format!(
|
||||
"{} {}w",
|
||||
"{} {size}w",
|
||||
self.thumbnail_path(filename, *size, extension),
|
||||
size,
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -266,7 +258,7 @@ impl State {
|
|||
}
|
||||
|
||||
fn image_path(&self, filename: &str) -> String {
|
||||
self.scoped(&format!("image/full/{}", filename))
|
||||
self.scoped(&format!("image/full/{filename}"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -686,7 +678,7 @@ async fn upload(
|
|||
}
|
||||
}
|
||||
Err(e) => {
|
||||
tracing::warn!("{}", e);
|
||||
tracing::warn!("{e}");
|
||||
let _ = store::DeleteEntry {
|
||||
entry_path: &entry_path2,
|
||||
}
|
||||
|
@ -982,7 +974,7 @@ fn to_svg_string(qr: &qrcodegen::QrCode, border: i32) -> String {
|
|||
.checked_add(border.checked_mul(2).unwrap())
|
||||
.unwrap();
|
||||
result += &format!(
|
||||
"<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewBox=\"0 0 {0} {0}\" stroke=\"none\">\n", dimension);
|
||||
"<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewBox=\"0 0 {dimension} {dimension}\" stroke=\"none\">\n");
|
||||
result += "\t<rect width=\"100%\" height=\"100%\" fill=\"#FFFFFF\"/>\n";
|
||||
result += "\t<path d=\"";
|
||||
for y in 0..qr.size() {
|
||||
|
|
Loading…
Reference in a new issue