Skip to content

Commit

Permalink
improve code and fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
houseme committed May 20, 2024
1 parent 12081e4 commit f31afbb
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
toolchain: nightly
override: true
default: true

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "qrcode-rs"
description = "QR code encoder in Rust,Generate QR Code matrices and images in RAW, PNG and SVG formats."
license = "MIT OR Apache-2.0"
version = "0.1.4"
version = "0.1.5"
edition = "2021"
authors = ["houseme <[email protected]>"]
repository = "https://github.com/houseme/qrcode-rs"
Expand Down
18 changes: 9 additions & 9 deletions src/canvas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1337,8 +1337,8 @@ mod data_iter_tests {

impl Canvas {
fn draw_codewords<I>(&mut self, codewords: &[u8], is_half_codeword_at_end: bool, coords: &mut I)
where
I: Iterator<Item=(i16, i16)>,
where
I: Iterator<Item = (i16, i16)>,
{
let length = codewords.len();
let last_word = if is_half_codeword_at_end { length - 1 } else { length };
Expand Down Expand Up @@ -1965,13 +1965,13 @@ impl Canvas {
Version::Normal(_) => ALL_PATTERNS_QR.iter(),
Version::Micro(_) => ALL_PATTERNS_MICRO_QR.iter(),
}
.map(|ptn| {
let mut c = self.clone();
c.apply_mask(*ptn);
c
})
.min_by_key(Self::compute_total_penalty_scores)
.expect("at least one pattern")
.map(|ptn| {
let mut c = self.clone();
c.apply_mask(*ptn);
c
})
.min_by_key(Self::compute_total_penalty_scores)
.expect("at least one pattern")
}

/// Convert the modules into a vector of booleans.
Expand Down
2 changes: 0 additions & 2 deletions src/cast.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::fmt::Display;

pub trait Truncate {
fn truncate_as_u8(self) -> u8;
}
Expand Down
4 changes: 2 additions & 2 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ impl Version {
/// If the entry compares equal to the default value of `T`, this method
/// returns `Err(QrError::InvalidVersion)`.
pub fn fetch<T>(self, ec_level: EcLevel, table: &[[T; 4]]) -> QrResult<T>
where
T: PartialEq + Default + Copy,
where
T: PartialEq + Default + Copy,
{
match self {
Version::Normal(v @ 1..=40) => {
Expand Down

0 comments on commit f31afbb

Please sign in to comment.