From cf184fbb4d1f8edb092e2598e312745b3658f303 Mon Sep 17 00:00:00 2001 From: Artem Varaksa Date: Tue, 26 Mar 2024 11:11:20 +0300 Subject: [PATCH] Address warnings, update edition and deps, etc. --- Cargo.toml | 14 +++++++------- src/lib.rs | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ef64ece..52006f1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "qr" version = "0.1.0" -authors = ["Artem Varaksa "] -edition = "2018" +authors = ["Artem Varaksa "] +edition = "2021" [lib] crate-type = ["cdylib", "rlib"] @@ -11,16 +11,16 @@ crate-type = ["cdylib", "rlib"] default = ["console_error_panic_hook"] [dependencies] -qrcode = "0.11.0" -url = "2.1" -cfg-if = "0.1.2" +qrcode = "0.14" +url = "2.5" +cfg-if = "1.0" wasm-bindgen = "0.2" # The `console_error_panic_hook` crate provides better debugging of panics by # logging them with `console.error`. This is great for development, but requires # all the `std::fmt` and `std::panicking` infrastructure, so isn't great for # code size when deploying. -console_error_panic_hook = { version = "0.1.1", optional = true } +console_error_panic_hook = { version = "0.1", optional = true } # `wee_alloc` is a tiny allocator for wasm that is only ~1K in code size # compared to the default allocator's ~10K. It is slower than the default @@ -28,7 +28,7 @@ console_error_panic_hook = { version = "0.1.1", optional = true } wee_alloc = { version = "0.4.2", optional = true } [dev-dependencies] -wasm-bindgen-test = "0.2" +wasm-bindgen-test = "0.3" [profile.release] # Tell `rustc` to optimize for small code size. diff --git a/src/lib.rs b/src/lib.rs index 5410034..2bca1fc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -33,7 +33,7 @@ fn parse_config(segments: &mut Split) -> Config { const DEFAULT_QUIET_ZONE: bool = true; let map = segments.fold(HashMap::new(), |mut acc, e| { - let pair = e.split("=").collect::>(); + let pair = e.split('=').collect::>(); if pair.len() < 2 { return acc; @@ -96,7 +96,7 @@ pub fn handle_request(url: String) -> Result { let text = match url.query() { Some(text) => text.to_owned(), - None => url.clone().into_string(), + None => url.clone().into(), }; let mut segments = url @@ -123,5 +123,5 @@ pub fn handle_request(url: String) -> Result { image_builder = image_builder.max_dimensions(size, size); } - Ok(format!("{}", image_builder.build())) + Ok(image_builder.build().to_string()) }