Enable more lints

This commit is contained in:
Joscha 2025-02-22 15:35:46 +01:00
parent ede8621867
commit 611bf3a9f1
5 changed files with 26 additions and 37 deletions

42
Cargo.lock generated
View file

@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo. # This file is automatically @generated by Cargo.
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3 version = 4
[[package]] [[package]]
name = "addr2line" name = "addr2line"
@ -556,7 +556,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c578f2b9abb4d5f3fbb12aba4008084d435dc6a8425c195cfe0b3594bfea0c25" checksum = "c578f2b9abb4d5f3fbb12aba4008084d435dc6a8425c195cfe0b3594bfea0c25"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.5.0",
"fontdb 0.16.2", "fontdb",
"libm", "libm",
"log", "log",
"rangemap", "rangemap",
@ -565,7 +565,7 @@ dependencies = [
"self_cell", "self_cell",
"swash", "swash",
"sys-locale", "sys-locale",
"ttf-parser 0.20.0", "ttf-parser",
"unicode-bidi", "unicode-bidi",
"unicode-linebreak", "unicode-linebreak",
"unicode-script", "unicode-script",
@ -862,21 +862,7 @@ dependencies = [
"memmap2", "memmap2",
"slotmap", "slotmap",
"tinyvec", "tinyvec",
"ttf-parser 0.20.0", "ttf-parser",
]
[[package]]
name = "fontdb"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d2894eb653f564384ae8da32b78d9c8db0394715525d917328e435b9babd902"
dependencies = [
"fontconfig-parser",
"log",
"memmap2",
"slotmap",
"tinyvec",
"ttf-parser 0.21.1",
] ]
[[package]] [[package]]
@ -1875,7 +1861,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2e0f8ad4c197db38125b880c3c44544788665c7d5f4c42f5a35da44bca1a712" checksum = "e2e0f8ad4c197db38125b880c3c44544788665c7d5f4c42f5a35da44bca1a712"
dependencies = [ dependencies = [
"ttf-parser 0.20.0", "ttf-parser",
] ]
[[package]] [[package]]
@ -2265,7 +2251,7 @@ dependencies = [
"bytemuck", "bytemuck",
"libm", "libm",
"smallvec", "smallvec",
"ttf-parser 0.20.0", "ttf-parser",
"unicode-bidi-mirroring", "unicode-bidi-mirroring",
"unicode-ccc", "unicode-ccc",
"unicode-properties", "unicode-properties",
@ -2396,7 +2382,6 @@ dependencies = [
"anyhow", "anyhow",
"comemo", "comemo",
"cosmic-text", "cosmic-text",
"fontdb 0.17.0",
"image 0.25.1", "image 0.25.1",
"mark", "mark",
"palette", "palette",
@ -2415,7 +2400,6 @@ dependencies = [
"anyhow", "anyhow",
"axum", "axum",
"clap", "clap",
"cosmic-text",
"escpos", "escpos",
"image 0.25.1", "image 0.25.1",
"mime_guess", "mime_guess",
@ -2915,12 +2899,6 @@ version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4" checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4"
[[package]]
name = "ttf-parser"
version = "0.21.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c591d83f69777866b9126b24c6dd9a18351f177e49d625920d19f989fd31cf8"
[[package]] [[package]]
name = "two-face" name = "two-face"
version = "0.3.0" version = "0.3.0"
@ -2957,7 +2935,7 @@ dependencies = [
"comemo", "comemo",
"csv", "csv",
"ecow", "ecow",
"fontdb 0.16.2", "fontdb",
"hayagriva", "hayagriva",
"hypher", "hypher",
"icu_properties", "icu_properties",
@ -2991,7 +2969,7 @@ dependencies = [
"syntect", "syntect",
"time", "time",
"toml", "toml",
"ttf-parser 0.20.0", "ttf-parser",
"two-face", "two-face",
"typed-arena", "typed-arena",
"typst-assets", "typst-assets",
@ -3038,7 +3016,7 @@ dependencies = [
"resvg", "resvg",
"roxmltree", "roxmltree",
"tiny-skia", "tiny-skia",
"ttf-parser 0.20.0", "ttf-parser",
"typst", "typst",
"typst-macros", "typst-macros",
"typst-timing", "typst-timing",
@ -3234,7 +3212,7 @@ version = "0.38.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c41888b9d5cf431fe852eaf9d047bbde83251b98f1749c2f08b1071e6db46e2" checksum = "8c41888b9d5cf431fe852eaf9d047bbde83251b98f1749c2f08b1071e6db46e2"
dependencies = [ dependencies = [
"fontdb 0.16.2", "fontdb",
"kurbo", "kurbo",
"log", "log",
"rustybuzz", "rustybuzz",

View file

@ -20,14 +20,27 @@ default-features = false
features = ["std", "taffy_tree", "flexbox", "grid", "block_layout"] features = ["std", "taffy_tree", "flexbox", "grid", "block_layout"]
[workspace.lints] [workspace.lints]
rust.unsafe_code = "forbid" rust.unsafe_code = { level = "forbid", priority = 1 }
# Lint groups
rust.deprecated_safe = "warn"
rust.future_incompatible = "warn" rust.future_incompatible = "warn"
rust.keyword_idents = "warn"
rust.rust_2018_idioms = "warn" rust.rust_2018_idioms = "warn"
rust.unused = "warn" rust.unused = "warn"
rust.noop_method_call = "warn" # Individual lints
rust.non_local_definitions = "warn"
rust.redundant_imports = "warn"
rust.redundant_lifetimes = "warn"
rust.single_use_lifetimes = "warn" rust.single_use_lifetimes = "warn"
rust.unit_bindings = "warn"
rust.unused_crate_dependencies = "warn"
rust.unused_import_braces = "warn"
rust.unused_lifetimes = "warn"
rust.unused_qualifications = "warn"
# Clippy
clippy.use_self = "warn" clippy.use_self = "warn"
# Optimize dependencies in debug mode (mainly for faster image exports). # Optimize dependencies in debug mode (mainly for faster image exports).
# Does not apply to workspace members, only "real" dependencies. # Does not apply to workspace members, only "real" dependencies.
# https://doc.rust-lang.org/cargo/reference/profiles.html#overrides # https://doc.rust-lang.org/cargo/reference/profiles.html#overrides

View file

@ -7,7 +7,6 @@ edition.workspace = true
anyhow.workspace = true anyhow.workspace = true
comemo = "0.4.0" comemo = "0.4.0"
cosmic-text.workspace = true cosmic-text.workspace = true
fontdb = "0.17.0"
image.workspace = true image.workspace = true
mark.git = "https://github.com/Garmelon/mark.git" mark.git = "https://github.com/Garmelon/mark.git"
palette.workspace = true palette.workspace = true

View file

@ -7,7 +7,6 @@ edition.workspace = true
anyhow.workspace = true anyhow.workspace = true
axum = { version = "0.7.5", features = ["multipart"] } axum = { version = "0.7.5", features = ["multipart"] }
clap = { version = "4.5.4", features = ["derive", "deprecated"] } clap = { version = "4.5.4", features = ["derive", "deprecated"] }
cosmic-text.workspace = true
escpos = { version = "0.12.2" } escpos = { version = "0.12.2" }
image.workspace = true image.workspace = true
mime_guess = "2.0.4" mime_guess = "2.0.4"

View file

@ -38,7 +38,7 @@ fn neighbors_at(image: &RgbaImage, x: u32, y: u32) -> [bool; 3] {
fn apply_rule(rule: u8, neighbors: [bool; 3]) -> bool { fn apply_rule(rule: u8, neighbors: [bool; 3]) -> bool {
let [left, mid, right] = neighbors.map(|n| n as u8); let [left, mid, right] = neighbors.map(|n| n as u8);
let index = left << 2 | mid << 1 | right; let index = (left << 2) | (mid << 1) | right;
rule & (1 << index) != 0 rule & (1 << index) != 0
} }