Skip to content

Commit

Permalink
Address warnings, update edition and deps, etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
awaitlink committed Mar 26, 2024
1 parent ca7e9e0 commit cf184fb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "qr"
version = "0.1.0"
authors = ["Artem Varaksa <aymfst@gmail.com>"]
edition = "2018"
authors = ["Artem Varaksa <artvaraksa@gmail.com>"]
edition = "2021"

[lib]
crate-type = ["cdylib", "rlib"]
Expand All @@ -11,24 +11,24 @@ 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
# allocator, however.
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.
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fn parse_config(segments: &mut Split<char>) -> Config {
const DEFAULT_QUIET_ZONE: bool = true;

let map = segments.fold(HashMap::new(), |mut acc, e| {
let pair = e.split("=").collect::<Vec<_>>();
let pair = e.split('=').collect::<Vec<_>>();

if pair.len() < 2 {
return acc;
Expand Down Expand Up @@ -96,7 +96,7 @@ pub fn handle_request(url: String) -> Result<String, JsValue> {

let text = match url.query() {
Some(text) => text.to_owned(),
None => url.clone().into_string(),
None => url.clone().into(),
};

let mut segments = url
Expand All @@ -123,5 +123,5 @@ pub fn handle_request(url: String) -> Result<String, JsValue> {
image_builder = image_builder.max_dimensions(size, size);
}

Ok(format!("{}", image_builder.build()))
Ok(image_builder.build().to_string())
}

0 comments on commit cf184fb

Please sign in to comment.