From 0d7e8da7f51f3b38a17380227915f88f7743b94c Mon Sep 17 00:00:00 2001 From: Ed Page Date: Tue, 29 Mar 2022 14:42:12 -0500 Subject: [PATCH 1/3] chore: Upgrade dependencies --- Cargo.lock | 100 ++++++++++++++++++++++++++++++++++++----------------- Cargo.toml | 6 ++-- 2 files changed, 72 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d36a168..2c00694 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -255,9 +255,9 @@ dependencies = [ [[package]] name = "concolor-clap" -version = "0.0.9" +version = "0.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0efdfa40e7f50b7ac8b2e336fad01c7071b9ab935b9082174cdb4e9fd5f6dc38" +checksum = "b35b55e880d42d4626e6a1aa5b4e63a4df61cf024472a31495ecbbb712402985" dependencies = [ "clap 3.1.3", "concolor", @@ -598,6 +598,18 @@ dependencies = [ "instant", ] +[[package]] +name = "filetime" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "975ccf83d8d9d0d84682850a38c8169027be83368805971cc4f238c2b245bc98" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "winapi", +] + [[package]] name = "fnv" version = "1.0.7" @@ -791,6 +803,16 @@ dependencies = [ "serde", ] +[[package]] +name = "kstring" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec3066350882a1cd6d950d055997f379ac37fd39f81cd4d8ed186032eb3c5747" +dependencies = [ + "serde", + "static_assertions", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -1294,12 +1316,50 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c970da16e7c682fa90a261cf0724dee241c9f7831635ecc4e988ae8f3b505559" +[[package]] +name = "similar" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e24979f63a11545f5f2c60141afe249d4f19f84581ea2138065e400941d83d3" + [[package]] name = "siphasher" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a86232ab60fa71287d7f2ddae4a7073f6b7aac33631c3015abb556f08c6d0a3e" +[[package]] +name = "snapbox" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1f212b806d6f56d19838e36a0aaa7e79a0bc9ca177e873fb87651ad92f983e2" +dependencies = [ + "concolor", + "content_inspector", + "dunce", + "filetime", + "normalize-line-endings", + "os_pipe", + "similar", + "snapbox-macros", + "tempfile", + "wait-timeout", + "walkdir", + "yansi", +] + +[[package]] +name = "snapbox-macros" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c01dea7e04cbb27ef4c86e9922184608185f7cd95c1763bc30d727cda4a5e930" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "strsim" version = "0.9.3" @@ -1415,19 +1475,6 @@ dependencies = [ "serde", ] -[[package]] -name = "toml_edit" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94217a6d6a89fb646cbc9f28283cf4745f77eb0b04c4f680c4b3ae4450e3a473" -dependencies = [ - "combine", - "indexmap", - "itertools", - "kstring", - "serde", -] - [[package]] name = "toml_edit" version = "0.13.4" @@ -1437,33 +1484,24 @@ dependencies = [ "combine", "indexmap", "itertools", - "kstring", + "kstring 1.0.6", "serde", ] [[package]] name = "trycmd" -version = "0.12.2" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "170d4db4fe81231f42ba55a50675f72590153d3c6ede8ae979bf3084bf2d8ae7" +checksum = "2c21f68a540a24b162ca101e3f7f4ce3c8458f594f28080018f29da23ad8567b" dependencies = [ - "concolor", - "content_inspector", - "difflib", - "dunce", "glob", "humantime", "humantime-serde", - "normalize-line-endings", - "os_pipe", "rayon", "serde", "shlex", - "tempfile", - "toml_edit 0.12.6", - "wait-timeout", - "walkdir", - "yansi", + "snapbox", + "toml_edit", ] [[package]] @@ -1512,14 +1550,14 @@ dependencies = [ "human-panic", "ignore", "itertools", - "kstring", + "kstring 2.0.0", "log", "maplit", "once_cell", "proc-exit", "serde", "serde_json", - "toml_edit 0.13.4", + "toml_edit", "trycmd", "typed-arena", "typos", diff --git a/Cargo.toml b/Cargo.toml index ae5293d..8a8d5c3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -74,7 +74,7 @@ env_logger = { version = "0.9", default-features = false, features = ["termcolor atty = "0.2.14" yansi = "0.5.0" concolor = { version = "0.0.8" } -concolor-clap = { version = "0.0.9", features = ["api_unstable"] } +concolor-clap = { version = "0.0.10", features = ["api_unstable"] } bstr = "0.2" once_cell = "1.2.0" ahash = "0.7" @@ -88,13 +88,13 @@ derive_setters = "0.1" itertools = "0.10" serde_json = "1.0" encoding = "0.2" -kstring = "1.0" +kstring = { version = "2.0.0", features = ["serde"] } typed-arena = "2.0.1" maplit = "1.0" [dev-dependencies] assert_fs = "1.0" -trycmd = "0.12.2" +trycmd = "0.13.3" criterion = "0.3" [profile.dev] From bf2c277951236de0d37dfd2470994b901a63d5e6 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Tue, 29 Mar 2022 14:56:17 -0500 Subject: [PATCH 2/3] chore: Bump MSRV --- .clippy.toml | 2 +- .github/workflows/ci.yml | 6 +++--- .github/workflows/codegen.yml | 2 +- .github/workflows/rust-next.yml | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.clippy.toml b/.clippy.toml index fc3ef79..6383191 100644 --- a/.clippy.toml +++ b/.clippy.toml @@ -1 +1 @@ -msrv = "1.54.0" # MSRV +msrv = "1.59.0" # MSRV diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c3c49ba..e3d6417 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,7 +51,7 @@ jobs: - name: No-default features run: cargo test --workspace --no-default-features msrv: - name: "Check MSRV: 1.54.0" + name: "Check MSRV: 1.59.0" runs-on: ubuntu-latest steps: - name: Checkout repository @@ -59,7 +59,7 @@ jobs: - name: Install Rust uses: actions-rs/toolchain@v1 with: - toolchain: 1.54.0 # MSRV + toolchain: 1.59.0 # MSRV profile: minimal override: true - uses: Swatinem/rust-cache@v1 @@ -113,7 +113,7 @@ jobs: - name: Install Rust uses: actions-rs/toolchain@v1 with: - toolchain: 1.54.0 # MSRV + toolchain: 1.59.0 # MSRV profile: minimal override: true components: clippy diff --git a/.github/workflows/codegen.yml b/.github/workflows/codegen.yml index 057b7ac..b0cdd16 100644 --- a/.github/workflows/codegen.yml +++ b/.github/workflows/codegen.yml @@ -26,7 +26,7 @@ jobs: - name: Install Rust uses: actions-rs/toolchain@v1 with: - toolchain: 1.54.0 # MSRV + toolchain: 1.59.0 # MSRV profile: minimal override: true components: rustfmt diff --git a/.github/workflows/rust-next.yml b/.github/workflows/rust-next.yml index 109429b..c8a7a61 100644 --- a/.github/workflows/rust-next.yml +++ b/.github/workflows/rust-next.yml @@ -59,9 +59,9 @@ jobs: strategy: matrix: rust: - - 1.54.0 # MSRV + - 1.59.0 # MSRV - stable - continue-on-error: ${{ matrix.rust != '1.54.0' }} # MSRV + continue-on-error: ${{ matrix.rust != '1.59.0' }} # MSRV runs-on: ubuntu-latest steps: - name: Checkout repository From 86c54fffbfa0edbbc709b143eac918c576b05ee5 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Tue, 29 Mar 2022 15:01:51 -0500 Subject: [PATCH 3/3] style: Update clippy --- crates/misspell-dict/codegen/src/main.rs | 2 +- crates/varcon-core/src/borrowed.rs | 2 +- src/bin/typos-cli/report.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/misspell-dict/codegen/src/main.rs b/crates/misspell-dict/codegen/src/main.rs index d0126ed..a290883 100644 --- a/crates/misspell-dict/codegen/src/main.rs +++ b/crates/misspell-dict/codegen/src/main.rs @@ -20,7 +20,7 @@ fn parse_dict(raw: &str) -> Words { let mut current = &mut bad; for line in raw.lines() { - let line = line.splitn(2, "//").next().unwrap().trim(); + let line = line.split_once("//").map(|l| l.0).unwrap_or(line).trim(); if line.is_empty() || line.starts_with("package") { continue; } else if line.contains("DictMain") { diff --git a/crates/varcon-core/src/borrowed.rs b/crates/varcon-core/src/borrowed.rs index 937c5dc..c73713a 100644 --- a/crates/varcon-core/src/borrowed.rs +++ b/crates/varcon-core/src/borrowed.rs @@ -47,7 +47,7 @@ pub struct Variant { impl Variant { pub fn into_owned(self) -> crate::Variant { crate::Variant { - types: self.types.iter().copied().collect(), + types: self.types.to_vec(), word: self.word.to_owned(), } } diff --git a/src/bin/typos-cli/report.rs b/src/bin/typos-cli/report.rs index d23d795..1eb6318 100644 --- a/src/bin/typos-cli/report.rs +++ b/src/bin/typos-cli/report.rs @@ -131,7 +131,7 @@ impl Report for PrintLong { fn print_brief_correction(msg: &Typo, palette: Palette) -> Result<(), std::io::Error> { let line = String::from_utf8_lossy(msg.buffer.as_ref()); - let line = line.replace("\t", " "); + let line = line.replace('\t', " "); let column = unicode_segmentation::UnicodeSegmentation::graphemes( line.get(0..msg.byte_offset).unwrap(), true, @@ -177,7 +177,7 @@ fn print_long_correction(msg: &Typo, palette: Palette) -> Result<(), std::io::Er let mut handle = stdout.lock(); let line = String::from_utf8_lossy(msg.buffer.as_ref()); - let line = line.replace("\t", " "); + let line = line.replace('\t', " "); let start = String::from_utf8_lossy(&msg.buffer[0..msg.byte_offset]); let column = unicode_segmentation::UnicodeSegmentation::graphemes(start.as_ref(), true).count(); match &msg.corrections {