From 31a7f7022b6156b4594440a822b0cdc1ec84aca4 Mon Sep 17 00:00:00 2001 From: Razvan Rus Date: Sat, 20 Jan 2024 12:08:24 +0200 Subject: [PATCH 01/65] added partial solution --- src/editor.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/editor.rs b/src/editor.rs index fe3c1e13..124e2020 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -3,7 +3,7 @@ use std::fmt::{Display, Write as _}; use std::io::{self, BufRead, BufReader, ErrorKind, Read, Seek, Write}; use std::iter::{self, repeat, successors}; -use std::{fs::File, path::Path, process::Command, thread, time::Instant}; +use std::{cell::RefCell, fs::File, path::Path, process::Command, thread, time::Instant}; use crate::row::{HlState, Row}; use crate::{ansi_escape::*, syntax::Conf as SyntaxConf, sys, terminal, Config, Error}; @@ -593,7 +593,7 @@ impl Editor { (self.rx() - self.cursor.coff + 1 + self.ln_pad, self.cursor.y - self.cursor.roff + 1) } else { // If in prompt mode, position the cursor on the prompt line at the end of the line. - (self.status_msg.as_ref().map_or(0, |sm| sm.msg.len() + 1), self.screen_rows + 2) + (self.status_msg.as_ref().map_or(0, |s| s.msg.chars().count() + 1), self.screen_rows + 2) }; // Finally, print `buffer` and move the cursor print!("{buffer}\x1b[{cursor_y};{cursor_x}H{SHOW_CURSOR}"); @@ -678,7 +678,7 @@ impl Editor { // will be updated in self.cursor.scroll() so that the result is visible (self.cursor.x, self.cursor.y, self.cursor.coff) = (cx, current, 0); let rx = row.cx2rx[cx]; - row.match_segment = Some(rx..rx + query.len()); + row.match_segment = Some(rx..rx + query.chars().count()); return Some(current); } } @@ -837,15 +837,15 @@ enum PromptState { Cancelled, } +thread_local! (static CHARACTER: RefCell> = {let mut cache = Vec::new(); RefCell::new(cache)}); /// Process a prompt keypress event and return the new state for the prompt. fn process_prompt_keypress(mut buffer: String, key: &Key) -> PromptState { match key { Key::Char(b'\r') => return PromptState::Completed(buffer), Key::Escape | Key::Char(EXIT) => return PromptState::Cancelled, - Key::Char(BACKSPACE | DELETE_BIS) => { - buffer.pop(); - } + Key::Char(BACKSPACE | DELETE_BIS) => {buffer.pop();}, Key::Char(c @ 0..=126) if !c.is_ascii_control() => buffer.push(*c as char), + Key::Char(c @ 128..=255) => CHARACTER.with(|cache| {cache.borrow_mut().push(*c); if String::from_utf8(cache.borrow_mut().clone()).is_ok() {buffer.push_str(String::from_utf8(cache.borrow_mut().clone()).unwrap().as_str()); cache.borrow_mut().clear();}}), // No-op _ => (), } From f63bcdb581bd820cfc63ea5767baf063ff12e24a Mon Sep 17 00:00:00 2001 From: Razvan Rus Date: Sat, 20 Jan 2024 13:24:32 +0200 Subject: [PATCH 02/65] better highlight length getter (using unicode_width) --- src/editor.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/editor.rs b/src/editor.rs index 124e2020..8645048c 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -5,6 +5,7 @@ use std::io::{self, BufRead, BufReader, ErrorKind, Read, Seek, Write}; use std::iter::{self, repeat, successors}; use std::{cell::RefCell, fs::File, path::Path, process::Command, thread, time::Instant}; +use unicode_width::UnicodeWidthStr; use crate::row::{HlState, Row}; use crate::{ansi_escape::*, syntax::Conf as SyntaxConf, sys, terminal, Config, Error}; @@ -593,7 +594,7 @@ impl Editor { (self.rx() - self.cursor.coff + 1 + self.ln_pad, self.cursor.y - self.cursor.roff + 1) } else { // If in prompt mode, position the cursor on the prompt line at the end of the line. - (self.status_msg.as_ref().map_or(0, |s| s.msg.chars().count() + 1), self.screen_rows + 2) + (self.status_msg.as_ref().map_or(0, |s| UnicodeWidthStr::width(s.msg.as_str()) + 1), self.screen_rows + 2) }; // Finally, print `buffer` and move the cursor print!("{buffer}\x1b[{cursor_y};{cursor_x}H{SHOW_CURSOR}"); @@ -678,7 +679,7 @@ impl Editor { // will be updated in self.cursor.scroll() so that the result is visible (self.cursor.x, self.cursor.y, self.cursor.coff) = (cx, current, 0); let rx = row.cx2rx[cx]; - row.match_segment = Some(rx..rx + query.chars().count()); + row.match_segment = Some(rx..rx + UnicodeWidthStr::width(query)); return Some(current); } } @@ -843,7 +844,7 @@ fn process_prompt_keypress(mut buffer: String, key: &Key) -> PromptState { match key { Key::Char(b'\r') => return PromptState::Completed(buffer), Key::Escape | Key::Char(EXIT) => return PromptState::Cancelled, - Key::Char(BACKSPACE | DELETE_BIS) => {buffer.pop();}, + Key::Char(BACKSPACE | DELETE_BIS) => _ = buffer.pop(), Key::Char(c @ 0..=126) if !c.is_ascii_control() => buffer.push(*c as char), Key::Char(c @ 128..=255) => CHARACTER.with(|cache| {cache.borrow_mut().push(*c); if String::from_utf8(cache.borrow_mut().clone()).is_ok() {buffer.push_str(String::from_utf8(cache.borrow_mut().clone()).unwrap().as_str()); cache.borrow_mut().clear();}}), // No-op From 7df0d7a457ec0953f61ddcb868ac79597bc2066d Mon Sep 17 00:00:00 2001 From: Razvan Rus Date: Sat, 20 Jan 2024 15:48:29 +0200 Subject: [PATCH 03/65] finnished coding style --- src/editor.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/editor.rs b/src/editor.rs index 8645048c..0104026e 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -6,6 +6,7 @@ use std::iter::{self, repeat, successors}; use std::{cell::RefCell, fs::File, path::Path, process::Command, thread, time::Instant}; use unicode_width::UnicodeWidthStr; + use crate::row::{HlState, Row}; use crate::{ansi_escape::*, syntax::Conf as SyntaxConf, sys, terminal, Config, Error}; @@ -29,9 +30,9 @@ const HELP_MESSAGE: &str = /// `set_status!` sets a formatted status message for the editor. /// Example usage: `set_status!(editor, "{} written to {}", file_size, file_name)` -macro_rules! set_status { - ($editor:expr, $($arg:expr),*) => ($editor.status_msg = Some(StatusMessage::new(format!($($arg),*)))) -} +macro_rules! set_status { ($editor:expr, $($arg:expr),*) => ($editor.status_msg = Some(StatusMessage::new(format!($($arg),*)))) } +// `width!` returns the display width of a string, plus one for the cursor +fn dsp_width(msg: &String) -> usize { UnicodeWidthStr::width(msg.as_str()) + 1 } /// Enum of input keys enum Key { @@ -594,7 +595,7 @@ impl Editor { (self.rx() - self.cursor.coff + 1 + self.ln_pad, self.cursor.y - self.cursor.roff + 1) } else { // If in prompt mode, position the cursor on the prompt line at the end of the line. - (self.status_msg.as_ref().map_or(0, |s| UnicodeWidthStr::width(s.msg.as_str()) + 1), self.screen_rows + 2) + (self.status_msg.as_ref().map_or(0, |s| dsp_width(&s.msg)), self.screen_rows + 2) }; // Finally, print `buffer` and move the cursor print!("{buffer}\x1b[{cursor_y};{cursor_x}H{SHOW_CURSOR}"); @@ -838,7 +839,7 @@ enum PromptState { Cancelled, } -thread_local! (static CHARACTER: RefCell> = {let mut cache = Vec::new(); RefCell::new(cache)}); +thread_local! (static CHARACTER: RefCell> = {let cache = Vec::new(); RefCell::new(cache)}); /// Process a prompt keypress event and return the new state for the prompt. fn process_prompt_keypress(mut buffer: String, key: &Key) -> PromptState { match key { @@ -846,10 +847,14 @@ fn process_prompt_keypress(mut buffer: String, key: &Key) -> PromptState { Key::Escape | Key::Char(EXIT) => return PromptState::Cancelled, Key::Char(BACKSPACE | DELETE_BIS) => _ = buffer.pop(), Key::Char(c @ 0..=126) if !c.is_ascii_control() => buffer.push(*c as char), - Key::Char(c @ 128..=255) => CHARACTER.with(|cache| {cache.borrow_mut().push(*c); if String::from_utf8(cache.borrow_mut().clone()).is_ok() {buffer.push_str(String::from_utf8(cache.borrow_mut().clone()).unwrap().as_str()); cache.borrow_mut().clear();}}), + Key::Char(c @ 128..=255) => CHARACTER.with(|cache| cache.borrow_mut().push(*c)), // No-op _ => (), } + let character = CHARACTER.with(|cache| String::from_utf8(cache.borrow_mut().clone())); + character.clone().map_or((), |c| buffer.push_str(c.as_str())); + character.map_or((), |_| CHARACTER.with(|cache| cache.borrow_mut().clear())); + PromptState::Active(buffer) } From 755da5ae52bbec8cf2c5a798425bba08d0a370e6 Mon Sep 17 00:00:00 2001 From: Razvan Rus Date: Sun, 21 Jan 2024 15:33:32 +0200 Subject: [PATCH 04/65] fixed warnings --- src/editor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/editor.rs b/src/editor.rs index 0104026e..2af34898 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -852,8 +852,8 @@ fn process_prompt_keypress(mut buffer: String, key: &Key) -> PromptState { _ => (), } let character = CHARACTER.with(|cache| String::from_utf8(cache.borrow_mut().clone())); - character.clone().map_or((), |c| buffer.push_str(c.as_str())); - character.map_or((), |_| CHARACTER.with(|cache| cache.borrow_mut().clear())); + let _ = character.clone().map_or((), |c| buffer.push_str(c.as_str())); + let _ = character.map_or((), |_| CHARACTER.with(|cache| cache.borrow_mut().clear())); PromptState::Active(buffer) } From 57268a28d43c8bed1da22ef02e6c745b64844d67 Mon Sep 17 00:00:00 2001 From: Razvan Rus <69893593+razvanrus2003@users.noreply.github.com> Date: Mon, 22 Jan 2024 04:07:12 +0200 Subject: [PATCH 05/65] Lines optimization (#280) * -2 lines * modified macro, -2 lines --- src/editor.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/editor.rs b/src/editor.rs index fe3c1e13..a5ecfc49 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -28,9 +28,7 @@ const HELP_MESSAGE: &str = /// `set_status!` sets a formatted status message for the editor. /// Example usage: `set_status!(editor, "{} written to {}", file_size, file_name)` -macro_rules! set_status { - ($editor:expr, $($arg:expr),*) => ($editor.status_msg = Some(StatusMessage::new(format!($($arg),*)))) -} +macro_rules! set_status { ($editor:expr, $($arg:expr),*) => ($editor.status_msg = Some(StatusMessage::new(format!($($arg),*)))) } /// Enum of input keys enum Key { @@ -842,9 +840,7 @@ fn process_prompt_keypress(mut buffer: String, key: &Key) -> PromptState { match key { Key::Char(b'\r') => return PromptState::Completed(buffer), Key::Escape | Key::Char(EXIT) => return PromptState::Cancelled, - Key::Char(BACKSPACE | DELETE_BIS) => { - buffer.pop(); - } + Key::Char(BACKSPACE | DELETE_BIS) => _ = buffer.pop(), Key::Char(c @ 0..=126) if !c.is_ascii_control() => buffer.push(*c as char), // No-op _ => (), From c919b27a5651c7f8454470777affd6b8eb709d96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ila=C3=AF=20Deutel?= Date: Mon, 22 Jan 2024 02:10:51 +0000 Subject: [PATCH 06/65] add auzkok as contributor for syntax-highlighting (#278) --- .all-contributorsrc | 9 +++++++++ README.md | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index fec61ca1..b1f548c6 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -258,6 +258,15 @@ "contributions": [ "test" ] + }, + { + "login": "auzkok", + "name": "auzkok", + "avatar_url": "https://avatars.githubusercontent.com/u/35302680?v=4", + "profile": "https://github.com/auzkok", + "contributions": [ + "syntax-highlighting" + ] } ], "commitType": "docs" diff --git a/README.md b/README.md index 6c3f8c23..d6c1a8a8 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md) [![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/ilai-deutel/kibi ) -[![All Contributors](https://img.shields.io/badge/all_contributors-27-orange.svg)](#contributors) +[![All Contributors](https://img.shields.io/badge/all_contributors-28-orange.svg)](#contributors) [![asciicast](assets/asciicast.gif)](https://asciinema.org/a/KY7tKPlxHXqRdJiv5KaTJbPj5) @@ -378,6 +378,7 @@ any kind welcome!
CosminGGeorgescu

💻
Tanvir

💠
Prisacaru Bogdan-Paul

⚠️ +
auzkok

💠 From 991dc7b21958ee663eda011e9ad5ad06c1d29458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ila=C3=AF=20Deutel?= Date: Mon, 22 Jan 2024 02:43:55 +0000 Subject: [PATCH 07/65] [CI] Fail on Clippy error (#283) --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bf964814..292f100c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -157,3 +157,4 @@ jobs: clippy_flags: --all-features --target ${{ matrix.target }} -- -D warnings -D clippy::pedantic tool_name: clippy-${{ matrix.target }} reporter: github-pr-review + level: error From 8966c462df424daaab54b3784cea09bd8c8b5c04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ila=C3=AF=20Deutel?= Date: Mon, 22 Jan 2024 03:05:18 +0000 Subject: [PATCH 08/65] [CI] Actually fail on Clippy error (#284) --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 292f100c..3e82aee2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -158,3 +158,4 @@ jobs: tool_name: clippy-${{ matrix.target }} reporter: github-pr-review level: error + fail_on_error: true From 1eeaab138d5a6caa621bf5960938efdf89804ebe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 18 Feb 2024 14:27:03 -0500 Subject: [PATCH 09/65] Bump libc from 0.2.152 to 0.2.153 (#286) Bumps [libc](https://github.com/rust-lang/libc) from 0.2.152 to 0.2.153. - [Release notes](https://github.com/rust-lang/libc/releases) - [Commits](https://github.com/rust-lang/libc/compare/0.2.152...0.2.153) --- updated-dependencies: - dependency-name: libc dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2769272b..64ac37a6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -158,9 +158,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.152" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "linux-raw-sys" diff --git a/Cargo.toml b/Cargo.toml index 1cdcc3c0..eba5bfc1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ include = ["src/**/*", "Cargo.toml", "LICENSE*", "COPYRIGHT"] unicode-width = "0.1.11" [target.'cfg(unix)'.dependencies] -libc = "0.2.152" +libc = "0.2.153" [target.'cfg(windows)'.dependencies] winapi = { version = "0.3.9", default-features = false, features = ["wincon"] } From 596945dc1efc329ba42e772799512386012878b2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 18 Feb 2024 14:27:12 -0500 Subject: [PATCH 10/65] Bump tempfile from 3.9.0 to 3.10.0 (#289) Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.9.0 to 3.10.0. - [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md) - [Commits](https://github.com/Stebalien/tempfile/compare/v3.9.0...v3.10.0) --- updated-dependencies: - dependency-name: tempfile dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 24 +++++++----------------- Cargo.toml | 2 +- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 64ac37a6..6c7f02e7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -51,9 +51,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "futures" @@ -214,7 +214,7 @@ checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", + "redox_syscall", "smallvec", "windows-targets 0.48.1", ] @@ -258,20 +258,11 @@ dependencies = [ "bitflags 1.3.2", ] -[[package]] -name = "redox_syscall" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "rustix" -version = "0.38.28" +version = "0.38.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" +checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" dependencies = [ "bitflags 2.4.1", "errno", @@ -339,13 +330,12 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.9.0" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" +checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" dependencies = [ "cfg-if", "fastrand", - "redox_syscall 0.4.1", "rustix", "windows-sys", ] diff --git a/Cargo.toml b/Cargo.toml index eba5bfc1..c1bd646c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ winapi = { version = "0.3.9", default-features = false, features = ["wincon"] } winapi-util = "0.1.6" [dev-dependencies] -tempfile = "3.9.0" +tempfile = "3.10.0" serial_test = "3.0.0" [badges] From a22a3bd2f45957464623cfa13e7b59446d563ec1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 18 Feb 2024 14:27:16 -0500 Subject: [PATCH 11/65] Bump tempfile from 3.9.0 to 3.10.0 in /fuzz (#288) Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.9.0 to 3.10.0. - [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md) - [Commits](https://github.com/Stebalien/tempfile/compare/v3.9.0...v3.10.0) --- updated-dependencies: - dependency-name: tempfile dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- fuzz/Cargo.lock | 34 +++++++++------------------------- fuzz/Cargo.toml | 2 +- 2 files changed, 10 insertions(+), 26 deletions(-) diff --git a/fuzz/Cargo.lock b/fuzz/Cargo.lock index 3510362a..5ae72c50 100644 --- a/fuzz/Cargo.lock +++ b/fuzz/Cargo.lock @@ -8,12 +8,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c38b6b6b79f671c25e1a3e785b7b82d7562ffc9cd3efdc98627e5668a2472490" -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - [[package]] name = "bitflags" version = "2.4.1" @@ -53,9 +47,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "jobserver" @@ -88,9 +82,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.151" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libfuzzer-sys" @@ -115,22 +109,13 @@ version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" -[[package]] -name = "redox_syscall" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "rustix" -version = "0.38.28" +version = "0.38.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" +checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" dependencies = [ - "bitflags 2.4.1", + "bitflags", "errno", "libc", "linux-raw-sys", @@ -139,13 +124,12 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.9.0" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" +checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" dependencies = [ "cfg-if", "fastrand", - "redox_syscall", "rustix", "windows-sys", ] diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index 9b118a33..6a8f1544 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -10,7 +10,7 @@ cargo-fuzz = true [dependencies] libfuzzer-sys = "0.4" -tempfile = "3.9.0" +tempfile = "3.10.0" env-test-util = "1.0.1" [dependencies.kibi] From 3d8e309d8315c7ec2126d685874b5bad7ef95111 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 22 Sep 2024 18:16:15 -0400 Subject: [PATCH 12/65] Bump tempfile from 3.10.0 to 3.10.1 in /fuzz (#290) Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.10.0 to 3.10.1. - [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md) - [Commits](https://github.com/Stebalien/tempfile/compare/v3.10.0...v3.10.1) --- updated-dependencies: - dependency-name: tempfile dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- fuzz/Cargo.lock | 4 ++-- fuzz/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fuzz/Cargo.lock b/fuzz/Cargo.lock index 5ae72c50..676c7b5e 100644 --- a/fuzz/Cargo.lock +++ b/fuzz/Cargo.lock @@ -124,9 +124,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.10.0" +version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", "fastrand", diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index 6a8f1544..6b9457af 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -10,7 +10,7 @@ cargo-fuzz = true [dependencies] libfuzzer-sys = "0.4" -tempfile = "3.10.0" +tempfile = "3.10.1" env-test-util = "1.0.1" [dependencies.kibi] From 230184cb92b773f7e35c41e6bdd080d22098f2cd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 22 Sep 2024 18:16:28 -0400 Subject: [PATCH 13/65] Bump tempfile from 3.10.0 to 3.10.1 (#291) Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.10.0 to 3.10.1. - [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md) - [Commits](https://github.com/Stebalien/tempfile/compare/v3.10.0...v3.10.1) --- updated-dependencies: - dependency-name: tempfile dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6c7f02e7..672b5854 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -330,9 +330,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.10.0" +version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", "fastrand", diff --git a/Cargo.toml b/Cargo.toml index c1bd646c..988a5a17 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ winapi = { version = "0.3.9", default-features = false, features = ["wincon"] } winapi-util = "0.1.6" [dev-dependencies] -tempfile = "3.10.0" +tempfile = "3.10.1" serial_test = "3.0.0" [badges] From 18a314d46a3567bf633846d3a7ffb23ff14bac2b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 22 Sep 2024 18:16:40 -0400 Subject: [PATCH 14/65] Bump unicode-width from 0.1.11 to 0.1.12 (#294) Bumps [unicode-width](https://github.com/unicode-rs/unicode-width) from 0.1.11 to 0.1.12. - [Commits](https://github.com/unicode-rs/unicode-width/compare/v0.1.11...v0.1.12) --- updated-dependencies: - dependency-name: unicode-width dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 672b5854..167b6c50 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -348,9 +348,9 @@ checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" [[package]] name = "unicode-width" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" +checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6" [[package]] name = "winapi" diff --git a/Cargo.toml b/Cargo.toml index 988a5a17..bf23ac4c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ categories = ["text-editors", "development-tools"] include = ["src/**/*", "Cargo.toml", "LICENSE*", "COPYRIGHT"] [dependencies] -unicode-width = "0.1.11" +unicode-width = "0.1.12" [target.'cfg(unix)'.dependencies] libc = "0.2.153" From 42b1ef2198fb02cea03fd5d68f8ffdda091e3c87 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 22 Sep 2024 18:16:53 -0400 Subject: [PATCH 15/65] Bump winapi-util from 0.1.6 to 0.1.8 (#295) Bumps [winapi-util](https://github.com/BurntSushi/winapi-util) from 0.1.6 to 0.1.8. - [Commits](https://github.com/BurntSushi/winapi-util/compare/0.1.6...0.1.8) --- updated-dependencies: - dependency-name: winapi-util dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 167b6c50..5cf8a565 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -370,11 +370,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" dependencies = [ - "winapi", + "windows-sys", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index bf23ac4c..da4e6e30 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ libc = "0.2.153" [target.'cfg(windows)'.dependencies] winapi = { version = "0.3.9", default-features = false, features = ["wincon"] } -winapi-util = "0.1.6" +winapi-util = "0.1.8" [dev-dependencies] tempfile = "3.10.1" From a1573deefb6a85229a49ce79c2d44828817755cd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 22 Sep 2024 18:17:09 -0400 Subject: [PATCH 16/65] Bump libc from 0.2.153 to 0.2.155 (#297) Bumps [libc](https://github.com/rust-lang/libc) from 0.2.153 to 0.2.155. - [Release notes](https://github.com/rust-lang/libc/releases) - [Commits](https://github.com/rust-lang/libc/compare/0.2.153...0.2.155) --- updated-dependencies: - dependency-name: libc dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5cf8a565..1e0c58b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -158,9 +158,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "linux-raw-sys" diff --git a/Cargo.toml b/Cargo.toml index da4e6e30..802113a5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ include = ["src/**/*", "Cargo.toml", "LICENSE*", "COPYRIGHT"] unicode-width = "0.1.12" [target.'cfg(unix)'.dependencies] -libc = "0.2.153" +libc = "0.2.155" [target.'cfg(windows)'.dependencies] winapi = { version = "0.3.9", default-features = false, features = ["wincon"] } From e08fcc434dfa5e047de1bd52af188f4c92cccd83 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2024 15:06:59 -0400 Subject: [PATCH 17/65] Bump libc from 0.2.155 to 0.2.158 (#301) --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1e0c58b0..6d778141 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -158,9 +158,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.155" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "linux-raw-sys" diff --git a/Cargo.toml b/Cargo.toml index 802113a5..6f067313 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ include = ["src/**/*", "Cargo.toml", "LICENSE*", "COPYRIGHT"] unicode-width = "0.1.12" [target.'cfg(unix)'.dependencies] -libc = "0.2.155" +libc = "0.2.158" [target.'cfg(windows)'.dependencies] winapi = { version = "0.3.9", default-features = false, features = ["wincon"] } From 306b115004895a358aa6edc510c58803a3f4ad9f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2024 15:07:39 -0400 Subject: [PATCH 18/65] Bump tempfile from 3.10.1 to 3.12.0 in /fuzz (#299) --- fuzz/Cargo.lock | 77 ++++++++++++++++++++++++++++++------------------- fuzz/Cargo.toml | 2 +- 2 files changed, 48 insertions(+), 31 deletions(-) diff --git a/fuzz/Cargo.lock b/fuzz/Cargo.lock index 676c7b5e..e74a62af 100644 --- a/fuzz/Cargo.lock +++ b/fuzz/Cargo.lock @@ -42,7 +42,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -82,9 +82,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "libfuzzer-sys" @@ -105,9 +105,9 @@ checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" [[package]] name = "once_cell" -version = "1.9.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "rustix" @@ -119,26 +119,27 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "tempfile" -version = "3.10.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" dependencies = [ "cfg-if", "fastrand", + "once_cell", "rustix", - "windows-sys", + "windows-sys 0.59.0", ] [[package]] name = "unicode-width" -version = "0.1.11" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" [[package]] name = "winapi" @@ -158,11 +159,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.6" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "winapi", + "windows-sys 0.52.0", ] [[package]] @@ -180,15 +181,25 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", + "windows_i686_gnullvm", "windows_i686_msvc", "windows_x86_64_gnu", "windows_x86_64_gnullvm", @@ -197,42 +208,48 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index 6b9457af..a186a756 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -10,7 +10,7 @@ cargo-fuzz = true [dependencies] libfuzzer-sys = "0.4" -tempfile = "3.10.1" +tempfile = "3.12.0" env-test-util = "1.0.1" [dependencies.kibi] From 8c607d604d76dc6074544b34dee03131c362f707 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2024 15:07:53 -0400 Subject: [PATCH 19/65] Bump winapi-util from 0.1.8 to 0.1.9 (#302) --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6d778141..23e87cde 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -370,9 +370,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ "windows-sys", ] diff --git a/Cargo.toml b/Cargo.toml index 6f067313..117e3e64 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ libc = "0.2.158" [target.'cfg(windows)'.dependencies] winapi = { version = "0.3.9", default-features = false, features = ["wincon"] } -winapi-util = "0.1.8" +winapi-util = "0.1.9" [dev-dependencies] tempfile = "3.10.1" From d0b3aee484ae1d1541730ec1bb42c53d692c9599 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Oct 2024 23:36:54 -0400 Subject: [PATCH 20/65] Bump libc from 0.2.158 to 0.2.159 (#303) Bumps [libc](https://github.com/rust-lang/libc) from 0.2.158 to 0.2.159. - [Release notes](https://github.com/rust-lang/libc/releases) - [Changelog](https://github.com/rust-lang/libc/blob/0.2.159/CHANGELOG.md) - [Commits](https://github.com/rust-lang/libc/compare/0.2.158...0.2.159) --- updated-dependencies: - dependency-name: libc dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 23e87cde..19ad25f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -158,9 +158,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.158" +version = "0.2.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" [[package]] name = "linux-raw-sys" diff --git a/Cargo.toml b/Cargo.toml index 117e3e64..f316a4fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ include = ["src/**/*", "Cargo.toml", "LICENSE*", "COPYRIGHT"] unicode-width = "0.1.12" [target.'cfg(unix)'.dependencies] -libc = "0.2.158" +libc = "0.2.159" [target.'cfg(windows)'.dependencies] winapi = { version = "0.3.9", default-features = false, features = ["wincon"] } From 132baa1c2030d854e94b619dcdb4f28c9452d18b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Oct 2024 23:37:05 -0400 Subject: [PATCH 21/65] Bump tempfile from 3.12.0 to 3.13.0 in /fuzz (#304) Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.12.0 to 3.13.0. - [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md) - [Commits](https://github.com/Stebalien/tempfile/compare/v3.12.0...v3.13.0) --- updated-dependencies: - dependency-name: tempfile dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- fuzz/Cargo.lock | 18 +++++++++--------- fuzz/Cargo.toml | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/fuzz/Cargo.lock b/fuzz/Cargo.lock index e74a62af..9a1b16e8 100644 --- a/fuzz/Cargo.lock +++ b/fuzz/Cargo.lock @@ -47,9 +47,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.1" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" [[package]] name = "jobserver" @@ -99,9 +99,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.12" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "once_cell" @@ -111,9 +111,9 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "rustix" -version = "0.38.31" +version = "0.38.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" dependencies = [ "bitflags", "errno", @@ -124,9 +124,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.12.0" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" +checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" dependencies = [ "cfg-if", "fastrand", @@ -163,7 +163,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index a186a756..19cb462f 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -10,7 +10,7 @@ cargo-fuzz = true [dependencies] libfuzzer-sys = "0.4" -tempfile = "3.12.0" +tempfile = "3.13.0" env-test-util = "1.0.1" [dependencies.kibi] From 44bf29aa75660bb95c5aeb77c4c995481c8f151c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ila=C3=AF=20Deutel?= Date: Sun, 13 Oct 2024 11:03:11 -0400 Subject: [PATCH 22/65] Bump MSRV to Rust 1.65.0 (#306) --- .github/workflows/ci.yml | 8 ++++---- Cargo.toml | 2 +- README.md | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3e82aee2..dc60ce78 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,19 +43,19 @@ jobs: # MSRV (Linux) - os: ubuntu-latest target: x86_64-unknown-linux-gnu - toolchain: 1.64.0 + toolchain: 1.65.0 # MSRV (MacOS) - os: macos-latest target: x86_64-apple-darwin - toolchain: 1.64.0 + toolchain: 1.65.0 # MSRV (Windows) - os: windows-latest target: x86_64-pc-windows-gnu - toolchain: 1.64.0 + toolchain: 1.65.0 # MSRV (WASI) - os: ubuntu-latest target: wasm32-wasi - toolchain: 1.64.0 + toolchain: 1.65.0 # Nightly (Linux) - os: ubuntu-latest diff --git a/Cargo.toml b/Cargo.toml index f316a4fa..24cc5437 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "kibi" version = "0.2.2" -rust-version = "1.64" +rust-version = "1.65" authors = ["Ilaï Deutel"] license = "MIT OR Apache-2.0" edition = "2018" diff --git a/README.md b/README.md index d6c1a8a8..03a27686 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Build Status](https://img.shields.io/github/actions/workflow/status/ilai-deutel/kibi/ci.yml?branch=master&logo=github-actions)](https://github.com/ilai-deutel/kibi/actions/workflows/ci.yml?query=branch%3Amaster) [![Lines of code](https://img.shields.io/github/actions/workflow/status/ilai-deutel/kibi/loc.yml?label=LOC%E2%89%A41024)](#) [![Crate](https://img.shields.io/crates/v/kibi.svg)](https://crates.io/crates/kibi) -[![Minimum rustc version](https://img.shields.io/badge/rustc-1.64+-blue.svg?logo=rust)](https://www.rust-lang.org/) +[![Minimum rustc version](https://img.shields.io/badge/rustc-1.65+-blue.svg?logo=rust)](https://www.rust-lang.org/) [![Platform](https://img.shields.io/badge/platform-Linux%20|%20macOS%20|%20Windows%2010%20|%20WASI-blue)](#) [![Packaging status](https://repology.org/badge/tiny-repos/kibi.svg)](https://repology.org/project/kibi/versions) [![Dependency Status](https://deps.rs/repo/github/ilai-deutel/kibi/status.svg)](https://deps.rs/repo/github/ilai-deutel/kibi) From da51e37afa273e6e0733b5ba9803c36c67146a01 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 13 Oct 2024 18:26:35 -0400 Subject: [PATCH 23/65] Bump serial_test from 3.0.0 to 3.1.1 (#293) Bumps [serial_test](https://github.com/palfrey/serial_test) from 3.0.0 to 3.1.1. - [Release notes](https://github.com/palfrey/serial_test/releases) - [Commits](https://github.com/palfrey/serial_test/compare/v3.0.0...v3.1.1) --- updated-dependencies: - dependency-name: serial_test dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 56 ++++++++++++++++++++++-------------------------------- Cargo.toml | 2 +- 2 files changed, 24 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 19ad25f6..f4bf552f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -26,19 +26,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "dashmap" -version = "5.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6943ae99c34386c84a470c499d3414f66502a41340aa895406e0d2e4a207b91d" -dependencies = [ - "cfg-if", - "hashbrown", - "lock_api", - "once_cell", - "parking_lot_core", -] - [[package]] name = "errno" version = "0.3.8" @@ -132,12 +119,6 @@ dependencies = [ "slab", ] -[[package]] -name = "hashbrown" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" - [[package]] name = "kibi" version = "0.2.2" @@ -150,12 +131,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - [[package]] name = "libc" version = "0.2.159" @@ -192,9 +167,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "once_cell" -version = "1.18.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "parking_lot" @@ -271,31 +246,46 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "scc" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "553f8299af7450cda9a52d3a370199904e7a46b5ffd1bef187c4a6af3bb6db69" +dependencies = [ + "sdd", +] + [[package]] name = "scopeguard" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sdd" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49c1eeaf4b6a87c7479688c6d52b9f1153cedd3c489300564f932b065c6eab95" + [[package]] name = "serial_test" -version = "3.0.0" +version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ad9342b3aaca7cb43c45c097dd008d4907070394bd0751a0aa8817e5a018d" +checksum = "4b4b487fe2acf240a021cf57c6b2b4903b1e78ca0ecd862a71b71d2a51fed77d" dependencies = [ - "dashmap", "futures", - "lazy_static", "log", + "once_cell", "parking_lot", + "scc", "serial_test_derive", ] [[package]] name = "serial_test_derive" -version = "3.0.0" +version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b93fb4adc70021ac1b47f7d45e8cc4169baaa7ea58483bc5b721d19a26202212" +checksum = "82fe9db325bcef1fbcde82e078a5cc4efdf787e96b3b9cf45b50b529f2083d67" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 24cc5437..8940f5f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ winapi-util = "0.1.9" [dev-dependencies] tempfile = "3.10.1" -serial_test = "3.0.0" +serial_test = "3.1.1" [badges] maintenance = { status = "actively-developed" } From 06bba14b167573463d782ec95f7b62225d535b11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ila=C3=AF=20Deutel?= Date: Sun, 13 Oct 2024 18:36:52 -0400 Subject: [PATCH 24/65] But MSRV to 1.66.0 (#307) --- .github/workflows/ci.yml | 8 ++++---- Cargo.toml | 2 +- README.md | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc60ce78..ee7317a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,19 +43,19 @@ jobs: # MSRV (Linux) - os: ubuntu-latest target: x86_64-unknown-linux-gnu - toolchain: 1.65.0 + toolchain: 1.66.0 # MSRV (MacOS) - os: macos-latest target: x86_64-apple-darwin - toolchain: 1.65.0 + toolchain: 1.66.0 # MSRV (Windows) - os: windows-latest target: x86_64-pc-windows-gnu - toolchain: 1.65.0 + toolchain: 1.66.0 # MSRV (WASI) - os: ubuntu-latest target: wasm32-wasi - toolchain: 1.65.0 + toolchain: 1.66.0 # Nightly (Linux) - os: ubuntu-latest diff --git a/Cargo.toml b/Cargo.toml index 8940f5f6..d9048065 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "kibi" version = "0.2.2" -rust-version = "1.65" +rust-version = "1.66" authors = ["Ilaï Deutel"] license = "MIT OR Apache-2.0" edition = "2018" diff --git a/README.md b/README.md index 03a27686..f800b82b 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Build Status](https://img.shields.io/github/actions/workflow/status/ilai-deutel/kibi/ci.yml?branch=master&logo=github-actions)](https://github.com/ilai-deutel/kibi/actions/workflows/ci.yml?query=branch%3Amaster) [![Lines of code](https://img.shields.io/github/actions/workflow/status/ilai-deutel/kibi/loc.yml?label=LOC%E2%89%A41024)](#) [![Crate](https://img.shields.io/crates/v/kibi.svg)](https://crates.io/crates/kibi) -[![Minimum rustc version](https://img.shields.io/badge/rustc-1.65+-blue.svg?logo=rust)](https://www.rust-lang.org/) +[![Minimum rustc version](https://img.shields.io/badge/rustc-1.66+-blue.svg?logo=rust)](https://www.rust-lang.org/) [![Platform](https://img.shields.io/badge/platform-Linux%20|%20macOS%20|%20Windows%2010%20|%20WASI-blue)](#) [![Packaging status](https://repology.org/badge/tiny-repos/kibi.svg)](https://repology.org/project/kibi/versions) [![Dependency Status](https://deps.rs/repo/github/ilai-deutel/kibi/status.svg)](https://deps.rs/repo/github/ilai-deutel/kibi) From 4e233847b3fdc86bc772cc8ed6bc9e83d955d390 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 13 Oct 2024 21:07:48 -0400 Subject: [PATCH 25/65] Bump unicode-width from 0.1.12 to 0.2.0 (#300) Bumps [unicode-width](https://github.com/unicode-rs/unicode-width) from 0.1.12 to 0.2.0. - [Commits](https://github.com/unicode-rs/unicode-width/commits) --- updated-dependencies: - dependency-name: unicode-width dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f4bf552f..a0079e6d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -338,9 +338,9 @@ checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" [[package]] name = "unicode-width" -version = "0.1.12" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" [[package]] name = "winapi" diff --git a/Cargo.toml b/Cargo.toml index d9048065..b60ef3cb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ categories = ["text-editors", "development-tools"] include = ["src/**/*", "Cargo.toml", "LICENSE*", "COPYRIGHT"] [dependencies] -unicode-width = "0.1.12" +unicode-width = "0.2.0" [target.'cfg(unix)'.dependencies] libc = "0.2.159" From 6ebc9ea09b5523144b73d812a448d4748dff2e17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ila=C3=AF=20Deutel?= Date: Tue, 12 Nov 2024 22:52:15 -0500 Subject: [PATCH 26/65] [CI] Migrate WASI targets (#316) See [announcement](https://blog.rust-lang.org/2024/04/09/updates-to-rusts-wasi-targets.html) --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ee7317a6..8452df03 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,7 +38,7 @@ jobs: # WASI - os: ubuntu-latest - target: wasm32-wasi + target: wasm32-wasip1 # MSRV (Linux) - os: ubuntu-latest @@ -74,7 +74,7 @@ jobs: coverage: true # Nightly (WASI) - os: ubuntu-latest - target: wasm32-wasi + target: wasm32-wasip1 toolchain: nightly coverage: true @@ -138,7 +138,7 @@ jobs: # WASI - os: ubuntu-latest - target: wasm32-wasi + target: wasm32-wasip1 runs-on: ${{ matrix.os }} From d14a358adac321908a207dddbb19c5eaa22a36f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ila=C3=AF=20Deutel?= Date: Tue, 12 Nov 2024 23:40:40 -0500 Subject: [PATCH 27/65] [CI] Upgrade code coverage generation (#317) --- .github/workflows/ci.yml | 62 +++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8452df03..0bf98843 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,65 +57,73 @@ jobs: target: wasm32-wasi toolchain: 1.66.0 + runs-on: ${{ matrix.os }} + + env: + RUSTFLAGS: '-D warnings' + + steps: + - uses: actions/checkout@v4 + - name: Install gcc-multilib + if: matrix.target == 'i686-unknown-linux-gnu' + run: | + sudo apt-get update + sudo apt-get install gcc-multilib + - name: Install Rust toolchain + run: | + rustup toolchain install ${{ matrix.toolchain || 'stable' }} + rustup override set ${{ matrix.toolchain || 'stable' }} + rustup target add --toolchain ${{ matrix.toolchain || 'stable' }} ${{ matrix.target }} + - name: Build + run: cargo build + - name: Run tests + run: cargo test --verbose --all-features --no-fail-fast + + build_and_test_nightly_with_coverage: + strategy: + matrix: + include: # Nightly (Linux) - os: ubuntu-latest target: x86_64-unknown-linux-gnu - toolchain: nightly - coverage: true # Nightly (MacOS) - os: macos-latest target: x86_64-apple-darwin - toolchain: nightly - coverage: true # Nightly (Windows) - os: windows-latest target: x86_64-pc-windows-gnu - toolchain: nightly - coverage: true # Nightly (WASI) - os: ubuntu-latest target: wasm32-wasip1 - toolchain: nightly - coverage: true runs-on: ${{ matrix.os }} env: - RUSTFLAGS: -D warnings + RUSTFLAGS: '-D warnings -C instrument-coverage' steps: - uses: actions/checkout@v4 - - name: Install gcc-multilib - if: matrix.target == 'i686-unknown-linux-gnu' - run: | - sudo apt-get update - sudo apt-get install gcc-multilib - name: Install Rust toolchain run: | - rustup toolchain install ${{ matrix.toolchain || 'stable' }} - rustup override set ${{ matrix.toolchain || 'stable' }} - rustup target add --toolchain ${{ matrix.toolchain || 'stable' }} ${{ matrix.target }} + rustup toolchain install nightly --component llvm-tools-preview --allow-downgrade + rustup override set nightly + rustup target add --toolchain nightly ${{ matrix.target }} - name: Build run: cargo build - - name: Run tests without coverage instrumentation - if: ${{ ! matrix.coverage }} - run: cargo test --verbose --all-features --no-fail-fast - name: Run tests with coverage instrumentation if: matrix.coverage run: cargo test --verbose --all-features --no-fail-fast env: - CARGO_INCREMENTAL: '0' - RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' - RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' + LLVM_PROFILE_FILE: 'kibi-%p-%m.profraw' - name: Collect code coverage results - if: matrix.coverage - uses: actions-rs/grcov@v0.1 - id: coverage + run: | + cargo install grcov + grcov . --binary-path ./target/debug/ --source-dir . --output-types lcov --branch --output-path lcov.info - name: Upload code coverage results if: matrix.coverage uses: codecov/codecov-action@v3 with: - files: ${{ steps.coverage.outputs.report }} + files: lcov.info flags: ${{ matrix.target }} fail_ci_if_error: false verbose: true From dba0a6e39a325a9a6d4c29a0383a5594e38f19ad Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 23:53:29 -0500 Subject: [PATCH 28/65] Bump tempfile from 3.10.1 to 3.13.0 (#309) Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.10.1 to 3.13.0. - [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md) - [Commits](https://github.com/Stebalien/tempfile/compare/v3.10.1...v3.13.0) --- updated-dependencies: - dependency-name: tempfile dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 89 ++++++++++++++++++++++++++++++++---------------------- Cargo.toml | 2 +- 2 files changed, 54 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a0079e6d..6f3ad0ba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -33,14 +33,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "fastrand" -version = "2.0.1" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" [[package]] name = "futures" @@ -139,9 +139,9 @@ checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" [[package]] name = "linux-raw-sys" -version = "0.4.12" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "lock_api" @@ -235,15 +235,15 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.31" +version = "0.38.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" dependencies = [ "bitflags 2.4.1", "errno", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -320,14 +320,15 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.10.1" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" dependencies = [ "cfg-if", "fastrand", + "once_cell", "rustix", - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -364,7 +365,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -379,7 +380,16 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", ] [[package]] @@ -399,17 +409,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -420,9 +431,9 @@ checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" @@ -432,9 +443,9 @@ checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" @@ -444,9 +455,15 @@ checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" @@ -456,9 +473,9 @@ checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" @@ -468,9 +485,9 @@ checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" @@ -480,9 +497,9 @@ checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" @@ -492,6 +509,6 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" diff --git a/Cargo.toml b/Cargo.toml index b60ef3cb..c2319656 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ winapi = { version = "0.3.9", default-features = false, features = ["wincon"] } winapi-util = "0.1.9" [dev-dependencies] -tempfile = "3.10.1" +tempfile = "3.13.0" serial_test = "3.1.1" [badges] From 03e18a314280025852134ec8fd4dbff96644cdb6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 00:27:21 -0500 Subject: [PATCH 29/65] Bump tempfile from 3.13.0 to 3.14.0 in /fuzz (#315) Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.13.0 to 3.14.0. - [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md) - [Commits](https://github.com/Stebalien/tempfile/compare/v3.13.0...v3.14.0) --- updated-dependencies: - dependency-name: tempfile dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- fuzz/Cargo.lock | 16 ++++++++-------- fuzz/Cargo.toml | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/fuzz/Cargo.lock b/fuzz/Cargo.lock index 9a1b16e8..76ec07a3 100644 --- a/fuzz/Cargo.lock +++ b/fuzz/Cargo.lock @@ -82,9 +82,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.158" +version = "0.2.162" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398" [[package]] name = "libfuzzer-sys" @@ -111,9 +111,9 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "rustix" -version = "0.38.37" +version = "0.38.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" +checksum = "99e4ea3e1cdc4b559b8e5650f9c8e5998e3e5c1343b4eaf034565f32318d63c0" dependencies = [ "bitflags", "errno", @@ -124,9 +124,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" +checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", "fastrand", @@ -137,9 +137,9 @@ dependencies = [ [[package]] name = "unicode-width" -version = "0.1.14" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" [[package]] name = "winapi" diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index 19cb462f..7b16e1d3 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -10,7 +10,7 @@ cargo-fuzz = true [dependencies] libfuzzer-sys = "0.4" -tempfile = "3.13.0" +tempfile = "3.14.0" env-test-util = "1.0.1" [dependencies.kibi] From 6d8a48d9f6506652c5ab6a5d070a0d3663fd0e07 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 00:28:55 -0500 Subject: [PATCH 30/65] Bump libfuzzer-sys from 0.4.7 to 0.4.8 in /fuzz (#314) Bumps [libfuzzer-sys](https://github.com/rust-fuzz/libfuzzer) from 0.4.7 to 0.4.8. - [Changelog](https://github.com/rust-fuzz/libfuzzer/blob/main/CHANGELOG.md) - [Commits](https://github.com/rust-fuzz/libfuzzer/compare/0.4.7...0.4.8) --- updated-dependencies: - dependency-name: libfuzzer-sys dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- fuzz/Cargo.lock | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fuzz/Cargo.lock b/fuzz/Cargo.lock index 76ec07a3..eb10077f 100644 --- a/fuzz/Cargo.lock +++ b/fuzz/Cargo.lock @@ -88,13 +88,12 @@ checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398" [[package]] name = "libfuzzer-sys" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a96cfd5557eb82f2b83fed4955246c988d331975a002961b07c81584d107e7f7" +checksum = "9b9569d2f74e257076d8c6bfa73fb505b46b851e51ddaecc825944aa3bed17fa" dependencies = [ "arbitrary", "cc", - "once_cell", ] [[package]] From 7261e690b20fd466267054e4015045bee068170d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 00:29:45 -0500 Subject: [PATCH 31/65] Bump libc from 0.2.159 to 0.2.162 (#313) Bumps [libc](https://github.com/rust-lang/libc) from 0.2.159 to 0.2.162. - [Release notes](https://github.com/rust-lang/libc/releases) - [Changelog](https://github.com/rust-lang/libc/blob/0.2.162/CHANGELOG.md) - [Commits](https://github.com/rust-lang/libc/compare/0.2.159...0.2.162) --- updated-dependencies: - dependency-name: libc dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6f3ad0ba..935ba931 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -133,9 +133,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.159" +version = "0.2.162" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" +checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398" [[package]] name = "linux-raw-sys" @@ -365,7 +365,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index c2319656..5a62165a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ include = ["src/**/*", "Cargo.toml", "LICENSE*", "COPYRIGHT"] unicode-width = "0.2.0" [target.'cfg(unix)'.dependencies] -libc = "0.2.159" +libc = "0.2.162" [target.'cfg(windows)'.dependencies] winapi = { version = "0.3.9", default-features = false, features = ["wincon"] } From 40e91ef0ff0bf955350799dd620ee8da865bd56d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 00:30:08 -0500 Subject: [PATCH 32/65] Bump serial_test from 3.1.1 to 3.2.0 (#312) Bumps [serial_test](https://github.com/palfrey/serial_test) from 3.1.1 to 3.2.0. - [Release notes](https://github.com/palfrey/serial_test/releases) - [Commits](https://github.com/palfrey/serial_test/compare/v3.1.1...v3.2.0) --- updated-dependencies: - dependency-name: serial_test dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 935ba931..81f38128 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -269,9 +269,9 @@ checksum = "49c1eeaf4b6a87c7479688c6d52b9f1153cedd3c489300564f932b065c6eab95" [[package]] name = "serial_test" -version = "3.1.1" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b4b487fe2acf240a021cf57c6b2b4903b1e78ca0ecd862a71b71d2a51fed77d" +checksum = "1b258109f244e1d6891bf1053a55d63a5cd4f8f4c30cf9a1280989f80e7a1fa9" dependencies = [ "futures", "log", @@ -283,9 +283,9 @@ dependencies = [ [[package]] name = "serial_test_derive" -version = "3.1.1" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82fe9db325bcef1fbcde82e078a5cc4efdf787e96b3b9cf45b50b529f2083d67" +checksum = "5d69265a08751de7844521fd15003ae0a888e035773ba05695c5c759a6f89eef" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 5a62165a..a82463e0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ winapi-util = "0.1.9" [dev-dependencies] tempfile = "3.13.0" -serial_test = "3.1.1" +serial_test = "3.2.0" [badges] maintenance = { status = "actively-developed" } From 591aa3ad6b4addfc3c12c0b60f8643a978c63c8e Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Wed, 13 Nov 2024 02:59:14 -0300 Subject: [PATCH 33/65] Use alternate screen (#310) --- src/ansi_escape.rs | 9 ++++++--- src/editor.rs | 5 +++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/ansi_escape.rs b/src/ansi_escape.rs index 147b8ec0..533ffbde 100644 --- a/src/ansi_escape.rs +++ b/src/ansi_escape.rs @@ -1,7 +1,10 @@ //! # ANSI Escape sequences -/// Clear from cursor to beginning of the screen -pub const CLEAR_SCREEN: &str = "\x1b[2J"; +/// Switches to the main buffer. +pub(crate) const USE_MAIN_SCREEN: &str = "\x1b[?1049l"; + +/// Switches to a new alternate screen buffer. +pub(crate) const USE_ALTERNATE_SCREEN: &str = "\x1b[?1049h"; /// Reset the formatting pub(crate) const RESET_FMT: &str = "\x1b[m"; @@ -10,7 +13,7 @@ pub(crate) const RESET_FMT: &str = "\x1b[m"; pub(crate) const REVERSE_VIDEO: &str = "\x1b[7m"; /// Move the cursor to 1:1 -pub const MOVE_CURSOR_TO_START: &str = "\x1b[H"; +pub(crate) const MOVE_CURSOR_TO_START: &str = "\x1b[H"; /// DECTCTEM: Make the cursor invisible pub(crate) const HIDE_CURSOR: &str = "\x1b[?25l"; diff --git a/src/editor.rs b/src/editor.rs index a5ecfc49..441ab089 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -170,8 +170,9 @@ impl Editor { // Enable raw mode and store the original (non-raw) terminal mode. editor.orig_term_mode = Some(sys::enable_raw_mode()?); - editor.update_window_size()?; + print!("{USE_ALTERNATE_SCREEN}"); + editor.update_window_size()?; set_status!(editor, "{}", HELP_MESSAGE); Ok(editor) @@ -723,7 +724,7 @@ impl Drop for Editor { sys::set_term_mode(&orig_term_mode).expect("Could not restore original terminal mode."); } if !thread::panicking() { - print!("{CLEAR_SCREEN}{MOVE_CURSOR_TO_START}"); + print!("{USE_MAIN_SCREEN}"); io::stdout().flush().expect("Could not flush stdout"); } } From 7684d287804647f79fe0fb1874b08bff61883730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ila=C3=AF=20Deutel?= Date: Wed, 13 Nov 2024 01:21:42 -0500 Subject: [PATCH 34/65] [CI] Upgrade action versions (#319) --- .github/workflows/ci.yml | 8 ++++---- .github/workflows/devskim.yml | 2 +- .github/workflows/slscan.yml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0bf98843..b6d44953 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -111,22 +111,22 @@ jobs: - name: Build run: cargo build - name: Run tests with coverage instrumentation - if: matrix.coverage run: cargo test --verbose --all-features --no-fail-fast env: LLVM_PROFILE_FILE: 'kibi-%p-%m.profraw' - name: Collect code coverage results run: | cargo install grcov - grcov . --binary-path ./target/debug/ --source-dir . --output-types lcov --branch --output-path lcov.info + grcov . --binary-path ./target/debug/ --source-dir . --output-types lcov --branch --output-path lcov.info --keep-only 'src/*' - name: Upload code coverage results - if: matrix.coverage - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: files: lcov.info flags: ${{ matrix.target }} fail_ci_if_error: false verbose: true + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} static_checks: strategy: diff --git a/.github/workflows/devskim.yml b/.github/workflows/devskim.yml index 7263e884..a2960025 100644 --- a/.github/workflows/devskim.yml +++ b/.github/workflows/devskim.yml @@ -26,6 +26,6 @@ jobs: uses: microsoft/DevSkim-Action@v1 - name: Upload DevSkim scan results to GitHub Security tab - uses: github/codeql-action/upload-sarif@v1 + uses: github/codeql-action/upload-sarif@v2 with: sarif_file: devskim-results.sarif diff --git a/.github/workflows/slscan.yml b/.github/workflows/slscan.yml index 05f3ce25..a903dc8d 100644 --- a/.github/workflows/slscan.yml +++ b/.github/workflows/slscan.yml @@ -30,6 +30,6 @@ jobs: output: reports - name: Upload report - uses: github/codeql-action/upload-sarif@v1 + uses: github/codeql-action/upload-sarif@v2 with: sarif_file: reports From a616ceda43d0dc528837ed48f9cd5133d3dac8ee Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 09:23:38 -0500 Subject: [PATCH 35/65] add Jan9103 as a contributor for code (#318) * update README.md [skip ci] * update .all-contributorsrc [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index b1f548c6..13a47292 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -267,6 +267,15 @@ "contributions": [ "syntax-highlighting" ] + }, + { + "login": "Jan9103", + "name": "Jan9103", + "avatar_url": "https://avatars.githubusercontent.com/u/55753387?v=4", + "profile": "https://github.com/Jan9103", + "contributions": [ + "code" + ] } ], "commitType": "docs" diff --git a/README.md b/README.md index f800b82b..f8c1fe08 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md) [![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/ilai-deutel/kibi ) -[![All Contributors](https://img.shields.io/badge/all_contributors-28-orange.svg)](#contributors) +[![All Contributors](https://img.shields.io/badge/all_contributors-29-orange.svg)](#contributors) [![asciicast](assets/asciicast.gif)](https://asciinema.org/a/KY7tKPlxHXqRdJiv5KaTJbPj5) @@ -380,6 +380,9 @@ any kind welcome!
Prisacaru Bogdan-Paul

⚠️
auzkok

💠 + +
Jan9103

💻 + From 657cb4dfd8d073729aaefb1d210f9c12b9f6aa3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ila=C3=AF=20Deutel?= Date: Wed, 13 Nov 2024 10:25:41 -0500 Subject: [PATCH 36/65] Update rusfmt config and fix associated clippy errors (#321) --- .github/workflows/devskim.yml | 2 +- .github/workflows/slscan.yml | 2 +- rustfmt.toml | 14 ++- src/config.rs | 30 ++--- src/editor.rs | 212 +++++++++++++++++++--------------- src/error.rs | 11 +- src/main.rs | 9 +- src/row.rs | 37 +++--- src/syntax.rs | 23 ++-- src/terminal.rs | 15 ++- src/unix.rs | 26 +++-- src/wasi.rs | 16 +-- src/windows.rs | 9 +- src/xdg.rs | 13 ++- 14 files changed, 242 insertions(+), 177 deletions(-) diff --git a/.github/workflows/devskim.yml b/.github/workflows/devskim.yml index a2960025..1822fc63 100644 --- a/.github/workflows/devskim.yml +++ b/.github/workflows/devskim.yml @@ -26,6 +26,6 @@ jobs: uses: microsoft/DevSkim-Action@v1 - name: Upload DevSkim scan results to GitHub Security tab - uses: github/codeql-action/upload-sarif@v2 + uses: github/codeql-action/upload-sarif@v3 with: sarif_file: devskim-results.sarif diff --git a/.github/workflows/slscan.yml b/.github/workflows/slscan.yml index a903dc8d..45d0f5eb 100644 --- a/.github/workflows/slscan.yml +++ b/.github/workflows/slscan.yml @@ -30,6 +30,6 @@ jobs: output: reports - name: Upload report - uses: github/codeql-action/upload-sarif@v2 + uses: github/codeql-action/upload-sarif@v3 with: sarif_file: reports diff --git a/rustfmt.toml b/rustfmt.toml index f44e2af7..343e3e11 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -2,10 +2,20 @@ brace_style = "PreferSameLine" condense_wildcard_suffixes = true fn_params_layout = "Compressed" fn_single_line = true +format_code_in_doc_comments = true +format_macro_matchers = true +format_strings = true +group_imports = "StdExternalCrate" inline_attribute_width = 50 +match_arm_blocks = false +normalize_comments = true +normalize_doc_attributes = true +overflow_delimited_expr = true +reorder_impl_items = true +style_edition = "2024" use_field_init_shorthand = true use_small_heuristics = "Max" use_try_shorthand = true +type_punctuation_density = "Compressed" where_single_line = true -match_arm_blocks = false -group_imports = "StdExternalCrate" +wrap_comments = true diff --git a/src/config.rs b/src/config.rs index e5cf8189..f0cee889 100644 --- a/src/config.rs +++ b/src/config.rs @@ -6,15 +6,15 @@ use std::io::{BufRead, BufReader}; use std::path::{Path, PathBuf}; use std::{fmt::Display, fs::File, str::FromStr, time::Duration}; -use crate::{sys::conf_dirs as cdirs, Error, Error::Config as ConfErr}; +use crate::{Error, Error::Config as ConfErr, sys::conf_dirs as cdirs}; /// The global Kibi configuration. #[derive(Debug, PartialEq, Eq)] pub struct Config { /// The size of a tab. Must be > 0. pub tab_stop: usize, - /// The number of confirmations needed before quitting, when changes have been made since the - /// file was last changed. + /// The number of confirmations needed before quitting, when changes have + /// been made since the file was last changed. pub quit_times: usize, /// The duration for which messages are shown in the status bar. pub message_dur: Duration, @@ -30,18 +30,20 @@ impl Default for Config { } impl Config { - /// Load the configuration, potentially overridden using `config.ini` files that can be located - /// in the following directories: + /// Load the configuration, potentially overridden using `config.ini` files + /// that can be located in the following directories: /// - On Linux, macOS, and other *nix systems: /// - `/etc/kibi` (system-wide configuration). - /// - `$XDG_CONFIG_HOME/kibi` if environment variable `$XDG_CONFIG_HOME` is defined, - /// `$HOME/.config/kibi` otherwise (user-level configuration). + /// - `$XDG_CONFIG_HOME/kibi` if environment variable `$XDG_CONFIG_HOME` + /// is defined, `$HOME/.config/kibi` otherwise (user-level + /// configuration). /// - On Windows: /// - `%APPDATA%\Kibi` /// /// # Errors /// - /// Will return `Err` if one of the configuration file cannot be parsed properly. + /// Will return `Err` if one of the configuration file cannot be parsed + /// properly. pub fn load() -> Result { let mut conf = Self::default(); @@ -70,8 +72,8 @@ impl Config { /// Process an INI file. /// -/// The `kv_fn` function will be called for each key-value pair in the file. Typically, this -/// function will update a configuration instance. +/// The `kv_fn` function will be called for each key-value pair in the file. +/// Typically, this function will update a configuration instance. pub fn process_ini_file(path: &Path, kv_fn: &mut F) -> Result<(), Error> where F: FnMut(&str, &str) -> Result<(), String> { let file = File::open(path).map_err(|e| ConfErr(path.into(), 0, e.to_string()))?; @@ -89,13 +91,13 @@ where F: FnMut(&str, &str) -> Result<(), String> { } /// Trim a value (right-hand side of a key=value INI line) and parses it. -pub fn parse_value, E: Display>(value: &str) -> Result { +pub fn parse_value, E: Display>(value: &str) -> Result { value.trim().parse().map_err(|e| format!("Parser error: {e}")) } -/// Split a comma-separated list of values (right-hand side of a key=value1,value2,... INI line) and -/// parse it as a Vec. -pub fn parse_values, E: Display>(value: &str) -> Result, String> { +/// Split a comma-separated list of values (right-hand side of a +/// key=value1,value2,... INI line) and parse it as a Vec. +pub fn parse_values, E: Display>(value: &str) -> Result, String> { value.split(',').map(parse_value).collect() } diff --git a/src/editor.rs b/src/editor.rs index 441ab089..d012002d 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -6,7 +6,7 @@ use std::iter::{self, repeat, successors}; use std::{fs::File, path::Path, process::Command, thread, time::Instant}; use crate::row::{HlState, Row}; -use crate::{ansi_escape::*, syntax::Conf as SyntaxConf, sys, terminal, Config, Error}; +use crate::{Config, Error, ansi_escape::*, syntax::Conf as SyntaxConf, sys, terminal}; const fn ctrl_key(key: u8) -> u8 { key & 0x1f } const EXIT: u8 = ctrl_key(b'Q'); @@ -23,11 +23,12 @@ const EXECUTE: u8 = ctrl_key(b'E'); const REMOVE_LINE: u8 = ctrl_key(b'R'); const BACKSPACE: u8 = 127; -const HELP_MESSAGE: &str = - "^S save | ^Q quit | ^F find | ^G go to | ^D duplicate | ^E execute | ^C copy | ^X cut | ^V paste"; +const HELP_MESSAGE: &str = "^S save | ^Q quit | ^F find | ^G go to | ^D duplicate | ^E execute | \ + ^C copy | ^X cut | ^V paste"; /// `set_status!` sets a formatted status message for the editor. -/// Example usage: `set_status!(editor, "{} written to {}", file_size, file_name)` +/// Example usage: `set_status!(editor, "{} written to {}", file_size, +/// file_name)` macro_rules! set_status { ($editor:expr, $($arg:expr),*) => ($editor.status_msg = Some(StatusMessage::new(format!($($arg),*)))) } /// Enum of input keys @@ -72,42 +73,47 @@ struct CursorState { impl CursorState { fn move_to_next_line(&mut self) { (self.x, self.y) = (0, self.y + 1); } - /// Scroll the terminal window vertically and horizontally (i.e. adjusting the row offset and - /// the column offset) so that the cursor can be shown. + /// Scroll the terminal window vertically and horizontally (i.e. adjusting + /// the row offset and the column offset) so that the cursor can be + /// shown. fn scroll(&mut self, rx: usize, screen_rows: usize, screen_cols: usize) { self.roff = self.roff.clamp(self.y.saturating_sub(screen_rows.saturating_sub(1)), self.y); self.coff = self.coff.clamp(rx.saturating_sub(screen_cols.saturating_sub(1)), rx); } } -/// The `Editor` struct, contains the state and configuration of the text editor. +/// The `Editor` struct, contains the state and configuration of the text +/// editor. #[derive(Default)] pub struct Editor { - /// If not `None`, the current prompt mode (Save, Find, GoTo). If `None`, we are in regular - /// edition mode. + /// If not `None`, the current prompt mode (`Save`, `Find`, `GoTo`, or + /// `Execute`). If `None`, we are in regular edition mode. prompt_mode: Option, /// The current state of the cursor. cursor: CursorState, /// The padding size used on the left for line numbering. ln_pad: usize, - /// The width of the current window. Will be updated when the window is resized. + /// The width of the current window. Will be updated when the window is + /// resized. window_width: usize, - /// The number of rows that can be used for the editor, excluding the status bar and the message - /// bar + /// The number of rows that can be used for the editor, excluding the status + /// bar and the message bar screen_rows: usize, - /// The number of columns that can be used for the editor, excluding the part used for line numbers + /// The number of columns that can be used for the editor, excluding the + /// part used for line numbers screen_cols: usize, - /// The collection of rows, including the content and the syntax highlighting information. + /// The collection of rows, including the content and the syntax + /// highlighting information. rows: Vec, /// Whether the document has been modified since it was open. dirty: bool, /// The configuration for the editor. config: Config, - /// The number of warnings remaining before we can quit without saving. Defaults to - /// `config.quit_times`, then decreases to 0. + /// The number of warnings remaining before we can quit without saving. + /// Defaults to `config.quit_times`, then decreases to 0. quit_times: usize, - /// The file name. If None, the user will be prompted for a file name the first time they try to - /// save. + /// The file name. If None, the user will be prompted for a file name the + /// first time they try to save. // TODO: It may be better to store a PathBuf instead file_name: Option, /// The current status message being shown. @@ -116,7 +122,8 @@ pub struct Editor { syntax: SyntaxConf, /// The number of bytes contained in `rows`. This excludes new lines. n_bytes: u64, - /// The original terminal mode. It will be restored when the `Editor` instance is dropped. + /// The original terminal mode. It will be restored when the `Editor` + /// instance is dropped. orig_term_mode: Option, /// The copied buffer of a row copied_row: Vec, @@ -141,16 +148,17 @@ fn format_size(n: u64) -> String { return format!("{n}B"); } // i is the largest value such that 1024 ^ i < n - // To find i we compute the smallest b such that n <= 1024 ^ b and subtract 1 from it + // To find i we compute the smallest b such that n <= 1024 ^ b and subtract 1 + // from it let i = (64 - n.leading_zeros() + 9) / 10 - 1; - // Compute the size with two decimal places (rounded down) as the last two digits of q - // This avoid float formatting reducing the binary size + // Compute the size with two decimal places (rounded down) as the last two + // digits of q This avoid float formatting reducing the binary size let q = 100 * n / (1024 << ((i - 1) * 10)); format!("{}.{:02}{}B", q / 100, q % 100, b" kMGTPEZ"[i as usize] as char) } -/// `slice_find` returns the index of `needle` in slice `s` if `needle` is a subslice of `s`, -/// otherwise returns `None`. +/// `slice_find` returns the index of `needle` in slice `s` if `needle` is a +/// subslice of `s`, otherwise returns `None`. fn slice_find(s: &[T], needle: &[T]) -> Option { (0..(s.len() + 1).saturating_sub(needle.len())).find(|&i| s[i..].starts_with(needle)) } @@ -160,8 +168,8 @@ impl Editor { /// /// # Errors /// - /// Will return `Err` if an error occurs when enabling termios raw mode, creating the signal hook - /// or when obtaining the terminal window size. + /// Will return `Err` if an error occurs when enabling termios raw mode, + /// creating the signal hook or when obtaining the terminal window size. #[allow(clippy::field_reassign_with_default)] // False positive : https://github.com/rust-lang/rust-clippy/issues/6312 pub fn new(config: Config) -> Result { sys::register_winsize_change_signal_handler()?; @@ -178,11 +186,13 @@ impl Editor { Ok(editor) } - /// Return the current row if the cursor points to an existing row, `None` otherwise. + /// Return the current row if the cursor points to an existing row, `None` + /// otherwise. fn current_row(&self) -> Option<&Row> { self.rows.get(self.cursor.y) } - /// Return the position of the cursor, in terms of rendered characters (as opposed to - /// `self.cursor.x`, which is the position of the cursor in terms of bytes). + /// Return the position of the cursor, in terms of rendered characters (as + /// opposed to `self.cursor.x`, which is the position of the cursor in + /// terms of bytes). fn rx(&self) -> usize { self.current_row().map_or(0, |r| r.cx2rx[self.cursor.x]) } /// Move the cursor following an arrow key (← → ↑ ↓). @@ -219,16 +229,17 @@ impl Editor { self.update_cursor_x_position(); } - /// Update the cursor x position. If the cursor y position has changed, the current position - /// might be illegal (x is further right than the last character of the row). If that is the - /// case, clamp `self.cursor.x`. + /// Update the cursor x position. If the cursor y position has changed, the + /// current position might be illegal (x is further right than the last + /// character of the row). If that is the case, clamp `self.cursor.x`. fn update_cursor_x_position(&mut self) { self.cursor.x = self.cursor.x.min(self.current_row().map_or(0, |row| row.chars.len())); } - /// Run a loop to obtain the key that was pressed. At each iteration of the loop (until a key is - /// pressed), we listen to the `ws_changed` channel to check if a window size change signal has - /// been received. When bytes are received, we match to a corresponding `Key`. In particular, + /// Run a loop to obtain the key that was pressed. At each iteration of the + /// loop (until a key is pressed), we listen to the `ws_changed` channel + /// to check if a window size change signal has been received. When + /// bytes are received, we match to a corresponding `Key`. In particular, /// we handle ANSI escape codes to return `Key::Delete`, `Key::Home` etc. fn loop_until_keypress(&mut self) -> Result { loop { @@ -238,8 +249,8 @@ impl Editor { self.refresh_screen()?; } let mut bytes = sys::stdin()?.bytes(); - // Match on the next byte received or, if the first byte is ('\x1b'), on the next - // few bytes. + // Match on the next byte received or, if the first byte is ('\x1b'), on + // the next few bytes. match bytes.next().transpose()? { Some(b'\x1b') => { return Ok(match bytes.next().transpose()? { @@ -286,7 +297,8 @@ impl Editor { } } - /// Update the `screen_rows`, `window_width`, `screen_cols` and `ln_padding` attributes. + /// Update the `screen_rows`, `window_width`, `screen_cols` and `ln_padding` + /// attributes. fn update_window_size(&mut self) -> Result<(), Error> { let wsize = sys::get_window_size().or_else(|_| terminal::get_window_size_using_cursor())?; // Make room for the status bar and status message @@ -295,12 +307,13 @@ impl Editor { Ok(()) } - /// Update the `screen_cols` and `ln_padding` attributes based on the maximum number of digits - /// for line numbers (since the left padding depends on this number of digits). + /// Update the `screen_cols` and `ln_padding` attributes based on the + /// maximum number of digits for line numbers (since the left padding + /// depends on this number of digits). fn update_screen_cols(&mut self) { - // The maximum number of digits to use for the line number is the number of digits of the - // last line number. This is equal to the number of times we can divide this number by ten, - // computed below using `successors`. + // The maximum number of digits to use for the line number is the number of + // digits of the last line number. This is equal to the number of times + // we can divide this number by ten, computed below using `successors`. let n_digits = successors(Some(self.rows.len()), |u| Some(u / 10).filter(|u| *u > 0)).count(); let show_line_num = self.config.show_line_num && n_digits + 2 < self.window_width / 4; @@ -308,9 +321,10 @@ impl Editor { self.screen_cols = self.window_width.saturating_sub(self.ln_pad); } - /// Given a file path, try to find a syntax highlighting configuration that matches the path - /// extension in one of the config directories (`/etc/kibi/syntax.d`, etc.). If such a - /// configuration is found, set the `syntax` attribute of the editor. + /// Given a file path, try to find a syntax highlighting configuration that + /// matches the path extension in one of the config directories + /// (`/etc/kibi/syntax.d`, etc.). If such a configuration is found, set + /// the `syntax` attribute of the editor. fn select_syntax_highlight(&mut self, path: &Path) -> Result<(), Error> { let extension = path.extension().and_then(std::ffi::OsStr::to_str); if let Some(s) = extension.and_then(|e| SyntaxConf::get(e).transpose()) { @@ -319,9 +333,9 @@ impl Editor { Ok(()) } - /// Update a row, given its index. If `ignore_following_rows` is `false` and the highlight state - /// has changed during the update (for instance, it is now in "multi-line comment" state, keep - /// updating the next rows + /// Update a row, given its index. If `ignore_following_rows` is `false` and + /// the highlight state has changed during the update (for instance, it + /// is now in "multi-line comment" state, keep updating the next rows fn update_row(&mut self, y: usize, ignore_following_rows: bool) { let mut hl_state = if y > 0 { self.rows[y - 1].hl_state } else { HlState::Normal }; for row in self.rows.iter_mut().skip(y) { @@ -330,8 +344,9 @@ impl Editor { if ignore_following_rows || hl_state == previous_hl_state { return; } - // If the state has changed (for instance, a multi-line comment started in this row), - // continue updating the following rows + // If the state has changed (for instance, a multi-line comment + // started in this row), continue updating the following + // rows } } @@ -343,8 +358,8 @@ impl Editor { } } - /// Insert a byte at the current cursor position. If there is no row at the current cursor - /// position, add a new row and insert the byte. + /// Insert a byte at the current cursor position. If there is no row at the + /// current cursor position, add a new row and insert the byte. fn insert_byte(&mut self, c: u8) { if let Some(row) = self.rows.get_mut(self.cursor.y) { row.chars.insert(self.cursor.x, c); @@ -357,13 +372,15 @@ impl Editor { (self.cursor.x, self.n_bytes, self.dirty) = (self.cursor.x + 1, self.n_bytes + 1, true); } - /// Insert a new line at the current cursor position and move the cursor to the start of the new - /// line. If the cursor is in the middle of a row, split off that row. + /// Insert a new line at the current cursor position and move the cursor to + /// the start of the new line. If the cursor is in the middle of a row, + /// split off that row. fn insert_new_line(&mut self) { let (position, new_row_chars) = if self.cursor.x == 0 { (self.cursor.y, Vec::new()) } else { - // self.rows[self.cursor.y] must exist, since cursor.x = 0 for any cursor.y ≥ row.len() + // self.rows[self.cursor.y] must exist, since cursor.x = 0 for any cursor.y ≥ + // row.len() let new_chars = self.rows[self.cursor.y].chars.split_off(self.cursor.x); self.update_row(self.cursor.y, false); (self.cursor.y + 1, new_chars) @@ -375,13 +392,15 @@ impl Editor { self.dirty = true; } - /// Delete a character at the current cursor position. If the cursor is located at the beginning - /// of a row that is not the first or last row, merge the current row and the previous row. If - /// the cursor is located after the last row, move up to the last character of the previous row. + /// Delete a character at the current cursor position. If the cursor is + /// located at the beginning of a row that is not the first or last row, + /// merge the current row and the previous row. If the cursor is located + /// after the last row, move up to the last character of the previous row. fn delete_char(&mut self) { if self.cursor.x > 0 { let row = &mut self.rows[self.cursor.y]; - // Obtain the number of bytes to be removed: could be 1-4 (UTF-8 character size). + // Obtain the number of bytes to be removed: could be 1-4 (UTF-8 character + // size). let n_bytes_to_remove = row.get_char_size(row.cx2rx[self.cursor.x] - 1); row.chars.splice(self.cursor.x - n_bytes_to_remove..self.cursor.x, iter::empty()); self.update_row(self.cursor.y, false); @@ -399,8 +418,8 @@ impl Editor { self.update_screen_cols(); (self.dirty, self.cursor.y) = (self.dirty, self.cursor.y - 1); } else if self.cursor.y == self.rows.len() { - // If the cursor is located after the last row, pressing backspace is equivalent to - // pressing the left arrow key. + // If the cursor is located after the last row, pressing backspace is equivalent + // to pressing the left arrow key. self.move_cursor(&AKey::Left, false); } } @@ -441,8 +460,8 @@ impl Editor { self.update_screen_cols(); } - /// Try to load a file. If found, load the rows and update the render and syntax highlighting. - /// If not found, do not return an error. + /// Try to load a file. If found, load the rows and update the render and + /// syntax highlighting. If not found, do not return an error. fn load(&mut self, path: &Path) -> Result<(), Error> { let ft = std::fs::metadata(path)?.file_type(); if !(ft.is_file() || ft.is_symlink()) { @@ -454,9 +473,10 @@ impl Editor { for line in BufReader::new(file).split(b'\n') { self.rows.push(Row::new(line?)); } - // If the file ends with an empty line or is empty, we need to append an empty row - // to `self.rows`. Unfortunately, BufReader::split doesn't yield an empty Vec in - // this case, so we need to check the last byte directly. + // If the file ends with an empty line or is empty, we need to append an empty + // row to `self.rows`. Unfortunately, BufReader::split doesn't + // yield an empty Vec in this case, so we need to check the last + // byte directly. let mut file = File::open(path)?; file.seek(io::SeekFrom::End(0))?; if file.bytes().next().transpose()?.map_or(true, |b| b == b'\n') { @@ -481,7 +501,7 @@ impl Editor { file.write_all(&row.chars)?; written += row.chars.len(); if i != (self.rows.len() - 1) { - file.write_all(&[b'\n'])?; + file.write_all(b"\n")?; written += 1; } } @@ -489,8 +509,9 @@ impl Editor { Ok(written) } - /// Save the text to a file and handle all errors. Errors and success messages will be printed - /// to the status bar. Return whether the file was successfully saved. + /// Save the text to a file and handle all errors. Errors and success + /// messages will be printed to the status bar. Return whether the file + /// was successfully saved. fn save_and_handle_io_errors(&mut self, file_name: &str) -> bool { let saved = self.save(file_name); // Print error or success message to the status bar @@ -503,8 +524,9 @@ impl Editor { saved.is_ok() } - /// Save to a file after obtaining the file path from the prompt. If successful, the `file_name` - /// attribute of the editor will be set and syntax highlighting will be updated. + /// Save to a file after obtaining the file path from the prompt. If + /// successful, the `file_name` attribute of the editor will be set and + /// syntax highlighting will be updated. fn save_as(&mut self, file_name: String) -> Result<(), Error> { // TODO: What if file_name already exists? if self.save_and_handle_io_errors(&file_name) { @@ -525,11 +547,13 @@ impl Editor { Ok(()) } - /// Return whether the file being edited is empty or not. If there is more than one row, even if - /// all the rows are empty, `is_empty` returns `false`, since the text contains new lines. + /// Return whether the file being edited is empty or not. If there is more + /// than one row, even if all the rows are empty, `is_empty` returns + /// `false`, since the text contains new lines. fn is_empty(&self) -> bool { self.rows.len() <= 1 && self.n_bytes == 0 } - /// Draw rows of text and empty rows on the terminal, by adding characters to the buffer. + /// Draw rows of text and empty rows on the terminal, by adding characters + /// to the buffer. fn draw_rows(&self, buffer: &mut String) -> Result<(), Error> { let row_it = self.rows.iter().map(Some).chain(repeat(None)).enumerate(); for (i, row) in row_it.skip(self.cursor.roff).take(self.screen_rows) { @@ -570,7 +594,8 @@ impl Editor { Ok(()) } - /// Draw the message bar on the terminal, by adding characters to the buffer. + /// Draw the message bar on the terminal, by adding characters to the + /// buffer. fn draw_message_bar(&self, buffer: &mut String) { buffer.push_str(CLEAR_LINE_RIGHT_OF_CURSOR); let msg_duration = self.config.message_dur; @@ -579,8 +604,8 @@ impl Editor { } } - /// Refresh the screen: update the offsets, draw the rows, the status bar, the message bar, and - /// move the cursor to the correct position. + /// Refresh the screen: update the offsets, draw the rows, the status bar, + /// the message bar, and move the cursor to the correct position. fn refresh_screen(&mut self) -> Result<(), Error> { self.cursor.scroll(self.rx(), self.screen_rows, self.screen_cols); let mut buffer = format!("{HIDE_CURSOR}{MOVE_CURSOR_TO_START}"); @@ -588,10 +613,12 @@ impl Editor { self.draw_status_bar(&mut buffer)?; self.draw_message_bar(&mut buffer); let (cursor_x, cursor_y) = if self.prompt_mode.is_none() { - // If not in prompt mode, position the cursor according to the `cursor` attributes. + // If not in prompt mode, position the cursor according to the `cursor` + // attributes. (self.rx() - self.cursor.coff + 1 + self.ln_pad, self.cursor.y - self.cursor.roff + 1) } else { - // If in prompt mode, position the cursor on the prompt line at the end of the line. + // If in prompt mode, position the cursor on the prompt line at the end of the + // line. (self.status_msg.as_ref().map_or(0, |sm| sm.msg.len() + 1), self.screen_rows + 2) }; // Finally, print `buffer` and move the cursor @@ -599,8 +626,9 @@ impl Editor { io::stdout().flush().map_err(Error::from) } - /// Process a key that has been pressed, when not in prompt mode. Returns whether the program - /// should exit, and optionally the prompt mode to switch to. + /// Process a key that has been pressed, when not in prompt mode. Returns + /// whether the program should exit, and optionally the prompt mode to + /// switch to. fn process_keypress(&mut self, key: &Key) -> (bool, Option) { // This won't be mutated, unless key is Key::Character(EXIT) let mut quit_times = self.config.quit_times; @@ -661,11 +689,12 @@ impl Editor { (false, prompt_mode) } - /// Try to find a query, this is called after pressing Ctrl-F and for each key that is pressed. - /// `last_match` is the last row that was matched, `forward` indicates whether to search forward - /// or backward. Returns the row of a new match, or `None` if the search was unsuccessful. + /// Try to find a query, this is called after pressing Ctrl-F and for each + /// key that is pressed. `last_match` is the last row that was matched, + /// `forward` indicates whether to search forward or backward. Returns + /// the row of a new match, or `None` if the search was unsuccessful. #[allow(clippy::trivially_copy_pass_by_ref)] // This Clippy recommendation is only relevant on 32 bit platforms. - fn find(&mut self, query: &str, last_match: &Option, forward: bool) -> Option { + fn find(&mut self, query: &str, last_match: Option, forward: bool) -> Option { let num_rows = self.rows.len(); let mut current = last_match.unwrap_or_else(|| num_rows.saturating_sub(1)); // TODO: Handle multiple matches per line @@ -673,8 +702,9 @@ impl Editor { current = (current + if forward { 1 } else { num_rows - 1 }) % num_rows; let row = &mut self.rows[current]; if let Some(cx) = slice_find(&row.chars, query.as_bytes()) { - // self.cursor.coff: Try to reset the column offset; if the match is after the offset, this - // will be updated in self.cursor.scroll() so that the result is visible + // self.cursor.coff: Try to reset the column offset; if the match is after the + // offset, this will be updated in self.cursor.scroll() so that + // the result is visible (self.cursor.x, self.cursor.y, self.cursor.coff) = (cx, current, 0); let rx = row.cx2rx[cx]; row.match_segment = Some(rx..rx + query.len()); @@ -742,8 +772,8 @@ enum PromptMode { Execute(String), } -// TODO: Use trait with mode_status_msg and process_keypress, implement the trait for separate -// structs for Save and Find? +// TODO: Use trait with mode_status_msg and process_keypress, implement the +// trait for separate structs for Save and Find? impl PromptMode { /// Return the status message to print for the selected `PromptMode`. fn status_msg(&self) -> String { @@ -776,7 +806,7 @@ impl PromptMode { Key::Arrow(AKey::Left | AKey::Up) => (last_match, false), _ => (None, true), }; - let curr_match = ed.find(&query, &last_match, forward); + let curr_match = ed.find(&query, last_match, forward); return Ok(Some(Self::Find(query, saved_cursor, curr_match))); } // The prompt was cancelled. Restore the previous position. diff --git a/src/error.rs b/src/error.rs index 3745239a..333c3c2f 100644 --- a/src/error.rs +++ b/src/error.rs @@ -7,15 +7,16 @@ pub enum Error { Io(std::io::Error), /// Wrapper around `std::fmt::Error` Fmt(std::fmt::Error), - /// Error returned when the window size obtained through a system call is invalid. + /// Error returned when the window size obtained through a system call is + /// invalid. InvalidWindowSize, /// Error setting or retrieving the cursor position. CursorPosition, - /// Configuration error. The three attributes correspond the file path, the line number and the - /// error message. + /// Configuration error. The three attributes correspond the file path, the + /// line number and the error message. Config(std::path::PathBuf, usize, String), - /// Too many arguments given to kibi. The attribute corresponds to the total number of command - /// line arguments. + /// Too many arguments given to kibi. The attribute corresponds to the total + /// number of command line arguments. TooManyArguments(usize), /// Unrecognized option given as a command line argument. UnrecognizedOption(String), diff --git a/src/main.rs b/src/main.rs index 9dd0a0c5..99b15e2e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,15 +2,16 @@ use kibi::{Config, Editor, Error}; -/// Load the configuration, initialize the editor and run the program, optionally opening a file if -/// an argument is given. +/// Load the configuration, initialize the editor and run the program, +/// optionally opening a file if an argument is given. /// /// # Errors /// -/// Any error that occur during the execution of the program will be returned by this function. +/// Any error that occur during the execution of the program will be returned by +/// this function. fn main() -> Result<(), Error> { let mut args = std::env::args(); - match (args.nth(1), /*remaining_args=*/ args.len()) { + match (args.nth(1), /* remaining_args= */ args.len()) { (Some(arg), 0) if arg == "--version" => println!("kibi {}", env!("KIBI_VERSION")), (Some(arg), 0) if arg.starts_with('-') => return Err(Error::UnrecognizedOption(arg)), (file_name, 0) => Editor::new(Config::load()?)?.run(&file_name)?, diff --git a/src/row.rs b/src/row.rs index fb853a6e..7415b65b 100644 --- a/src/row.rs +++ b/src/row.rs @@ -1,7 +1,7 @@ //! # Row //! -//! Utilities for rows. A `Row` owns the underlying characters, the rendered string and the syntax -//! highlighting information. +//! Utilities for rows. A `Row` owns the underlying characters, the rendered +//! string and the syntax highlighting information. use std::{fmt::Write, iter::repeat}; @@ -19,7 +19,8 @@ pub enum HlState { Normal, /// A multi-line comment has been open, but not yet closed. MultiLineComment, - /// A string has been open with the given quote character (for instance b'\'' or b'"'), but not yet closed. + /// A string has been open with the given quote character (for instance + /// b'\'' or b'"'), but not yet closed. String(u8), /// A multi-line string has been open, but not yet closed. MultiLineString, @@ -30,18 +31,22 @@ pub enum HlState { pub struct Row { /// The characters of the row. pub chars: Vec, - /// How the characters are rendered. In particular, tabs are converted into several spaces, and - /// bytes may be combined into single UTF-8 characters. + /// How the characters are rendered. In particular, tabs are converted into + /// several spaces, and bytes may be combined into single UTF-8 + /// characters. render: String, - /// Mapping from indices in `self.chars` to the corresponding indices in `self.render`. + /// Mapping from indices in `self.chars` to the corresponding indices in + /// `self.render`. pub cx2rx: Vec, - /// Mapping from indices in `self.render` to the corresponding indices in `self.chars`. + /// Mapping from indices in `self.render` to the corresponding indices in + /// `self.chars`. pub rx2cx: Vec, /// The vector of `HLType` for each rendered character. hl: Vec, /// The final state of the row. pub hl_state: HlState, - /// If not `None`, the range that is currently matched during a FIND operation. + /// If not `None`, the range that is currently matched during a FIND + /// operation. pub match_segment: Option>, } @@ -67,9 +72,9 @@ impl Row { self.update_syntax(syntax, hl_state) } - /// Obtain the character size, in bytes, given its position in `self.render`. This is done in - /// constant time by using the difference between `self.rx2cx[rx]` and the cx for the next - /// character. + /// Obtain the character size, in bytes, given its position in + /// `self.render`. This is done in constant time by using the difference + /// between `self.rx2cx[rx]` and the cx for the next character. pub fn get_char_size(&self, rx: usize) -> usize { let cx0 = self.rx2cx[rx]; self.rx2cx.iter().skip(rx + 1).map(|cx| cx - cx0).find(|d| *d > 0).unwrap_or(1) @@ -80,7 +85,8 @@ impl Row { self.hl.clear(); let line = self.render.as_bytes(); - // Delimiters for multi-line comments and multi-line strings, as Option<&String, &String> + // Delimiters for multi-line comments and multi-line strings, as Option<&String, + // &String> let ml_comment_delims = syntax.ml_comment_delims.as_ref().map(|(start, end)| (start, end)); let ml_string_delims = syntax.ml_string_delim.as_ref().map(|x| (x, x)); @@ -167,9 +173,10 @@ impl Row { self.hl_state } - /// Draw the row and write the result to a buffer. An `offset` can be given, as well as a limit - /// on the length of the row (`max_len`). After writing the characters, clear the rest of the - /// line and move the cursor to the start of the next line. + /// Draw the row and write the result to a buffer. An `offset` can be given, + /// as well as a limit on the length of the row (`max_len`). After + /// writing the characters, clear the rest of the line and move the + /// cursor to the start of the next line. pub fn draw(&self, offset: usize, max_len: usize, buffer: &mut String) -> Result<(), Error> { let mut current_hl_type = HlType::Normal; let chars = self.render.chars().skip(offset).take(max_len); diff --git a/src/syntax.rs b/src/syntax.rs index 65dc106c..f33949b1 100644 --- a/src/syntax.rs +++ b/src/syntax.rs @@ -2,13 +2,13 @@ use std::fmt::{self, Display, Formatter}; use std::path::{Path, PathBuf}; use crate::config::{self, parse_value as pv, parse_values as pvs}; -use crate::{sys, Error}; +use crate::{Error, sys}; /// Type of syntax highlighting for a single rendered character. /// -/// Each `HLType` is associated with a color, via its discriminant. The ANSI color is equal -/// to the discriminant, modulo 100. The colors are described here: -/// +/// Each `HLType` is associated with a color, via its discriminant. The ANSI +/// color is equal to the discriminant, modulo 100. The colors are described +/// here: #[derive(PartialEq, Eq, Copy, Clone)] pub enum HlType { Normal = 39, // Default foreground color @@ -23,7 +23,8 @@ pub enum HlType { } impl Display for HlType { - /// Write the ANSI color escape sequence for the `HLType` using the given formatter. + /// Write the ANSI color escape sequence for the `HLType` using the given + /// formatter. fn fmt(&self, f: &mut Formatter) -> fmt::Result { write!(f, "\x1b[{}m", (*self as u32) % 100) } } @@ -40,16 +41,17 @@ pub struct Conf { pub sl_comment_start: Vec, /// The tokens that start and end a multi-line comment, e.g. ("/*", "*/"). pub ml_comment_delims: Option<(String, String)>, - /// The token that start and end a multi-line strings, e.g. "\"\"\"" for Python. + /// The token that start and end a multi-line strings, e.g. "\"\"\"" for + /// Python. pub ml_string_delim: Option, - /// Keywords to highlight and there corresponding HLType (typically - /// HLType::Keyword1 or HLType::Keyword2) + /// Keywords to highlight and there corresponding `HLType` (typically + /// `HLType::Keyword1` or `HLType::Keyword2`) pub keywords: Vec<(HlType, Vec)>, } impl Conf { - /// Return the syntax configuration corresponding to the given file extension, if a matching - /// INI file is found in a config directory. + /// Return the syntax configuration corresponding to the given file + /// extension, if a matching INI file is found in a config directory. pub fn get(ext: &str) -> Result, Error> { for conf_dir in sys::data_dirs() { match PathBuf::from(conf_dir).join("syntax.d").read_dir() { @@ -66,6 +68,7 @@ impl Conf { } Ok(None) } + /// Load a `SyntaxConf` from file. pub fn from_file(path: &Path) -> Result<(Self, Vec), Error> { let (mut sc, mut extensions) = (Self::default(), Vec::new()); diff --git a/src/terminal.rs b/src/terminal.rs index 803634c3..753cec9e 100644 --- a/src/terminal.rs +++ b/src/terminal.rs @@ -1,14 +1,16 @@ use std::io::{self, BufRead, Read, Write}; -use crate::{ansi_escape::DEVICE_STATUS_REPORT, ansi_escape::REPOSITION_CURSOR_END, sys, Error}; +use crate::{Error, ansi_escape::DEVICE_STATUS_REPORT, ansi_escape::REPOSITION_CURSOR_END, sys}; /// Obtain the window size using the cursor position. /// -/// This function moves the cursor to the bottom-right using ANSI escape sequence -/// `\x1b[999C\x1b[999B`, then requests the cursor position using ANSI escape sequence `\x1b[6n`. -/// After this sequence is sent, the next characters on stdin should be `\x1b[{row};{column}R`. +/// This function moves the cursor to the bottom-right using ANSI escape +/// sequence `\x1b[999C\x1b[999B`, then requests the cursor position using ANSI +/// escape sequence `\x1b[6n`. After this sequence is sent, the next characters +/// on stdin should be `\x1b[{row};{column}R`. /// -/// It is used as an alternative method if `sys::get_window_size()` returns an error. +/// It is used as an alternative method if `sys::get_window_size()` returns an +/// error. pub fn get_window_size_using_cursor() -> Result<(usize, usize), Error> { let mut stdin = sys::stdin()?; print!("{REPOSITION_CURSOR_END}{DEVICE_STATUS_REPORT}"); @@ -21,7 +23,8 @@ pub fn get_window_size_using_cursor() -> Result<(usize, usize), Error> { Ok((read_value_until(b';')?, read_value_until(b'R')?)) } -/// Read value until a certain stop byte is reached, and parse the result (pre-stop byte). +/// Read value until a certain stop byte is reached, and parse the result +/// (pre-stop byte). fn read_value_until(stop_byte: u8) -> Result { let mut buf = Vec::new(); io::stdin().lock().read_until(stop_byte, &mut buf)?; diff --git a/src/unix.rs b/src/unix.rs index a73cc835..126c04bf 100644 --- a/src/unix.rs +++ b/src/unix.rs @@ -1,16 +1,17 @@ //! # sys (UNIX) //! -//! UNIX-specific structs and functions. Will be imported as `sys` on UNIX systems. +//! UNIX-specific structs and functions. Will be imported as `sys` on UNIX +//! systems. use std::sync::atomic::{AtomicBool, Ordering::Relaxed}; // On UNIX systems, termios represents the terminal mode. pub use libc::termios as TermMode; -use libc::{c_int, c_void, sigaction, sighandler_t, siginfo_t, winsize}; use libc::{SA_SIGINFO, STDIN_FILENO, STDOUT_FILENO, TCSADRAIN, TIOCGWINSZ, VMIN, VTIME}; +use libc::{c_int, c_void, sigaction, sighandler_t, siginfo_t, winsize}; -pub use crate::xdg::*; use crate::Error; +pub use crate::xdg::*; fn cerr(err: c_int) -> Result<(), Error> { match err { @@ -21,8 +22,8 @@ fn cerr(err: c_int) -> Result<(), Error> { /// Return the current window size as (rows, columns). /// -/// We use the `TIOCGWINSZ` ioctl to get window size. If it succeeds, a `Winsize` struct will be -/// populated. +/// We use the `TIOCGWINSZ` ioctl to get window size. If it succeeds, a +/// `Winsize` struct will be populated. /// This ioctl is described here: pub fn get_window_size() -> Result<(usize, usize), Error> { let mut maybe_ws = std::mem::MaybeUninit::::uninit(); @@ -32,20 +33,22 @@ pub fn get_window_size() -> Result<(usize, usize), Error> { .map_or(Err(Error::InvalidWindowSize), |ws| Ok((ws.ws_row as usize, ws.ws_col as usize))) } -/// Stores whether the window size has changed since last call to `has_window_size_changed`. +/// Stores whether the window size has changed since last call to +/// `has_window_size_changed`. static WSC: AtomicBool = AtomicBool::new(false); /// Handle a change in window size. extern "C" fn handle_wsize(_: c_int, _: *mut siginfo_t, _: *mut c_void) { WSC.store(true, Relaxed) } -/// Register a signal handler that sets a global variable when the window size changes. -/// After calling this function, use `has_window_size_changed` to query the global variable. +/// Register a signal handler that sets a global variable when the window size +/// changes. After calling this function, use `has_window_size_changed` to query +/// the global variable. pub fn register_winsize_change_signal_handler() -> Result<(), Error> { unsafe { let mut maybe_sa = std::mem::MaybeUninit::::uninit(); cerr(libc::sigemptyset(&mut (*maybe_sa.as_mut_ptr()).sa_mask))?; - // We could use sa_handler here, however, sigaction defined in libc does not have - // sa_handler field, so we use sa_sigaction instead. + // We could use sa_handler here, however, sigaction defined in libc does not + // have sa_handler field, so we use sa_sigaction instead. (*maybe_sa.as_mut_ptr()).sa_flags = SA_SIGINFO; (*maybe_sa.as_mut_ptr()).sa_sigaction = handle_wsize as sighandler_t; cerr(libc::sigaction(libc::SIGWINCH, maybe_sa.as_ptr(), std::ptr::null_mut())) @@ -53,7 +56,8 @@ pub fn register_winsize_change_signal_handler() -> Result<(), Error> { } /// Check if the windows size has changed since the last call to this function. -/// The `register_winsize_change_signal_handler` needs to be called before this function. +/// The `register_winsize_change_signal_handler` needs to be called before this +/// function. pub fn has_window_size_changed() -> bool { WSC.swap(false, Relaxed) } /// Set the terminal mode. diff --git a/src/wasi.rs b/src/wasi.rs index 02fd1b04..c19d5eae 100644 --- a/src/wasi.rs +++ b/src/wasi.rs @@ -1,23 +1,25 @@ //! # sys (WASI) //! -//! WASI-specific structs and functions. Will be imported as `sys` on WASI systems. +//! WASI-specific structs and functions. Will be imported as `sys` on WASI +//! systems. -pub use crate::xdg::*; use crate::Error; +pub use crate::xdg::*; pub struct TermMode {} /// Return the current window size as (rows, columns). -/// By returning an error we cause kibi to fall back to another method of getting the window size +/// By returning an error we cause kibi to fall back to another method of +/// getting the window size pub fn get_window_size() -> Result<(usize, usize), Error> { Err(Error::InvalidWindowSize) } -/// Register a signal handler that sets a global variable when the window size changes. On WASI -/// platforms, this does nothing. +/// Register a signal handler that sets a global variable when the window size +/// changes. On WASI platforms, this does nothing. #[allow(clippy::unnecessary_wraps)] // Result required on other platforms pub fn register_winsize_change_signal_handler() -> Result<(), Error> { Ok(()) } -/// Check if the windows size has changed since the last call to this function. On WASI platforms, -/// this always return false. +/// Check if the windows size has changed since the last call to this function. +/// On WASI platforms, this always return false. pub fn has_window_size_changed() -> bool { false } /// Set the terminal mode. On WASI platforms, this does nothing. diff --git a/src/windows.rs b/src/windows.rs index c8e7aa2c..9e0a8f24 100644 --- a/src/windows.rs +++ b/src/windows.rs @@ -1,18 +1,19 @@ //! # sys (Windows) //! -//! Windows-specific structs and functions. Will be imported as `sys` on Windows systems. +//! Windows-specific structs and functions. Will be imported as `sys` on Windows +//! systems. #![allow(clippy::wildcard_imports)] use std::{convert::TryInto, env::var, io}; use winapi::um::wincon::*; -use winapi_util::{console as cons, HandleRef}; +use winapi_util::{HandleRef, console as cons}; use crate::Error; -// On Windows systems, the terminal mode is represented as 2 unsigned integers (one for stdin, one -// for stdout). +// On Windows systems, the terminal mode is represented as 2 unsigned integers +// (one for stdin, one for stdout). pub type TermMode = (u32, u32); /// Return configuration directories for Windows systems diff --git a/src/xdg.rs b/src/xdg.rs index b75effcb..b3c9cd50 100644 --- a/src/xdg.rs +++ b/src/xdg.rs @@ -11,14 +11,15 @@ pub(crate) fn xdg_dirs(xdg_type: &str, def_home_suffix: &str, def_dirs: &str) -> let mut dirs = Vec::new(); - // If environment variable `home_key` (e.g. `$XDG_CONFIG_HOME`) is set, add its value to `dirs`. - // Otherwise, if environment variable `$HOME` is set, add `$HOME{def_home_suffix}` - // (e.g. `$HOME/.config`) to `dirs`. + // If environment variable `home_key` (e.g. `$XDG_CONFIG_HOME`) is set, add its + // value to `dirs`. Otherwise, if environment variable `$HOME` is set, add + // `$HOME{def_home_suffix}` (e.g. `$HOME/.config`) to `dirs`. dirs.extend(var(home_key).or_else(|_| var("HOME").map(|d| d + def_home_suffix))); - // If environment variable `dirs_key` (e.g. `XDG_CONFIG_DIRS`) is set, split by `:` and add the - // parts to `dirs`. - // Otherwise, add the split `def_dirs` (e.g. `/etc/xdg:/etc`) and add the parts to `dirs`. + // If environment variable `dirs_key` (e.g. `XDG_CONFIG_DIRS`) is set, split by + // `:` and add the parts to `dirs`. + // Otherwise, add the split `def_dirs` (e.g. `/etc/xdg:/etc`) and add the parts + // to `dirs`. dirs.extend(var(dirs_key).unwrap_or_else(|_| def_dirs.into()).split(':').map(String::from)); dirs.into_iter().map(|p| p + "/kibi").collect() From f989f6f79f63ff4380ec0ef044b1b3ddf6526ce3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ila=C3=AF=20Deutel?= Date: Wed, 13 Nov 2024 10:39:42 -0500 Subject: [PATCH 37/65] Update README.md - HelloGitHub claim MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ilaï Deutel --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index f8c1fe08..16b0ab4f 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ ) [![All Contributors](https://img.shields.io/badge/all_contributors-29-orange.svg)](#contributors) +Featured|HelloGitHub [![asciicast](assets/asciicast.gif)](https://asciinema.org/a/KY7tKPlxHXqRdJiv5KaTJbPj5) From 52972306bb1d5f1164c81a5db34641b19c7115ee Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 18:20:21 -0500 Subject: [PATCH 38/65] add joshka as a contributor for infra (#324) * update README.md [skip ci] * update .all-contributorsrc [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 13a47292..e82faa94 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -276,6 +276,15 @@ "contributions": [ "code" ] + }, + { + "login": "joshka", + "name": "Josh McKinney", + "avatar_url": "https://avatars.githubusercontent.com/u/381361?v=4", + "profile": "http://joshka.net", + "contributions": [ + "infra" + ] } ], "commitType": "docs" diff --git a/README.md b/README.md index 16b0ab4f..28e20cc1 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md) [![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/ilai-deutel/kibi ) -[![All Contributors](https://img.shields.io/badge/all_contributors-29-orange.svg)](#contributors) +[![All Contributors](https://img.shields.io/badge/all_contributors-30-orange.svg)](#contributors) Featured|HelloGitHub @@ -383,6 +383,7 @@ any kind welcome!
Jan9103

💻 +
Josh McKinney

🚇 From e33d26f2e9e2a3d8f7a4799114945ca4708496a7 Mon Sep 17 00:00:00 2001 From: Jan9103 <55753387+Jan9103@users.noreply.github.com> Date: Thu, 14 Nov 2024 13:41:28 +0000 Subject: [PATCH 39/65] fix: crash when opening a new file (#287) Bug Reproduction: rm foo.txt; kibi foo.txt --- src/editor.rs | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/src/editor.rs b/src/editor.rs index d012002d..350efd68 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -463,33 +463,31 @@ impl Editor { /// Try to load a file. If found, load the rows and update the render and /// syntax highlighting. If not found, do not return an error. fn load(&mut self, path: &Path) -> Result<(), Error> { - let ft = std::fs::metadata(path)?.file_type(); + let mut file = match File::open(path) { + Err(e) if e.kind() == ErrorKind::NotFound => { + self.rows.push(Row::new(Vec::new())); + return Ok(()); + } + r => r, + }?; + let ft = file.metadata()?.file_type(); if !(ft.is_file() || ft.is_symlink()) { return Err(io::Error::new(ErrorKind::InvalidInput, "Invalid input file type").into()); } - - match File::open(path) { - Ok(file) => { - for line in BufReader::new(file).split(b'\n') { - self.rows.push(Row::new(line?)); - } - // If the file ends with an empty line or is empty, we need to append an empty - // row to `self.rows`. Unfortunately, BufReader::split doesn't - // yield an empty Vec in this case, so we need to check the last - // byte directly. - let mut file = File::open(path)?; - file.seek(io::SeekFrom::End(0))?; - if file.bytes().next().transpose()?.map_or(true, |b| b == b'\n') { - self.rows.push(Row::new(Vec::new())); - } - self.update_all_rows(); - // The number of rows has changed. The left padding may need to be updated. - self.update_screen_cols(); - self.n_bytes = self.rows.iter().map(|row| row.chars.len() as u64).sum(); - } - Err(e) if e.kind() == ErrorKind::NotFound => self.rows.push(Row::new(Vec::new())), - Err(e) => return Err(e.into()), + for line in BufReader::new(&file).split(b'\n') { + self.rows.push(Row::new(line?)); + } + // If the file ends with an empty line or is empty, we need to append an empty + // row to `self.rows`. Unfortunately, BufReader::split doesn't yield an + // empty Vec in this case, so we need to check the last byte directly. + file.seek(io::SeekFrom::End(0))?; + if file.bytes().next().transpose()?.map_or(true, |b| b == b'\n') { + self.rows.push(Row::new(Vec::new())); } + self.update_all_rows(); + // The number of rows has changed. The left padding may need to be updated. + self.update_screen_cols(); + self.n_bytes = self.rows.iter().map(|row| row.chars.len() as u64).sum(); Ok(()) } From cb13bcefd35babc5176fa12381eebabf6ace45ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ila=C3=AF=20Deutel?= Date: Thu, 14 Nov 2024 10:34:22 -0500 Subject: [PATCH 40/65] [CI] Configure secret token for reviewdog (#332) --- .github/workflows/ci.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b6d44953..0e39b8e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -150,6 +150,9 @@ jobs: runs-on: ${{ matrix.os }} + permissions: + pull-requests: write + steps: - uses: actions/checkout@v4 - name: Install nightly with clippy and rustfmt @@ -157,9 +160,13 @@ jobs: rustup toolchain install nightly --component rustfmt --component clippy --allow-downgrade rustup override set nightly rustup target add --toolchain nightly ${{ matrix.target }} - - name: Run rustfmt check - run: cargo fmt --check - - name: Run Clippy + - name: Format + if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }} + uses: mbrobbel/rustfmt-check@master + with: + token: ${{ secrets.GITHUB_TOKEN }} + mode: review + - name: Clippy uses: giraffate/clippy-action@v1 with: clippy_flags: --all-features --target ${{ matrix.target }} -- -D warnings -D clippy::pedantic @@ -167,3 +174,4 @@ jobs: reporter: github-pr-review level: error fail_on_error: true + github_token: ${{ secrets.GITHUB_TOKEN }} From be558cf9e24ea1e7322d3b38c240ef7b36dc8daf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ila=C3=AF=20Deutel?= Date: Thu, 14 Nov 2024 10:49:17 -0500 Subject: [PATCH 41/65] [Clippy] Check in config, update CI (#333) --- .github/workflows/ci.yml | 2 +- Cargo.toml | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e39b8e5..c388357a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -169,7 +169,7 @@ jobs: - name: Clippy uses: giraffate/clippy-action@v1 with: - clippy_flags: --all-features --target ${{ matrix.target }} -- -D warnings -D clippy::pedantic + clippy_flags: --all-features --all-targets --target ${{ matrix.target }} tool_name: clippy-${{ matrix.target }} reporter: github-pr-review level: error diff --git a/Cargo.toml b/Cargo.toml index a82463e0..ca54d8f4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,3 +28,12 @@ serial_test = "3.2.0" [badges] maintenance = { status = "actively-developed" } + +[lints.clippy] +correctness = "deny" +style = "deny" +complexity = "deny" +perf = "deny" +pedantic = "deny" +nursery = "allow" +restriction = "allow" From cce6e938edbee8cc8972fd03d20348d4d560abef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ila=C3=AF=20Deutel?= Date: Thu, 14 Nov 2024 18:38:08 -0500 Subject: [PATCH 42/65] Combine mod xdg with cfg(any) (LOC -= 1) (#335) --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 50740b0c..3736a6a0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -16,9 +16,9 @@ mod terminal; #[cfg(windows)] use windows as sys; #[cfg(unix)] mod unix; -#[cfg(unix)] mod xdg; #[cfg(unix)] use unix as sys; #[cfg(target_os = "wasi")] mod wasi; -#[cfg(target_os = "wasi")] mod xdg; #[cfg(target_os = "wasi")] use wasi as sys; + +#[cfg(any(unix, target_os = "wasi"))] mod xdg; From 1422e1e07a110972bb3ce8d81bc53d63516d36eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ila=C3=AF=20Deutel?= Date: Thu, 14 Nov 2024 20:33:29 -0500 Subject: [PATCH 43/65] [Clippy] Add nursery-level warnings, fix issues found (#334) --- .github/workflows/ci.yml | 18 ++++++++++-------- Cargo.toml | 2 +- src/config.rs | 4 ++-- src/editor.rs | 6 +++--- src/row.rs | 2 +- src/wasi.rs | 10 +++++----- src/xdg.rs | 2 +- 7 files changed, 23 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c388357a..25b70600 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -152,6 +152,7 @@ jobs: permissions: pull-requests: write + checks: write steps: - uses: actions/checkout@v4 @@ -166,12 +167,13 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} mode: review + - name: Set up cargo-action-fmt + if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }} + uses: olix0r/cargo-action-fmt/setup@v2 - name: Clippy - uses: giraffate/clippy-action@v1 - with: - clippy_flags: --all-features --all-targets --target ${{ matrix.target }} - tool_name: clippy-${{ matrix.target }} - reporter: github-pr-review - level: error - fail_on_error: true - github_token: ${{ secrets.GITHUB_TOKEN }} + if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }} + run: cargo clippy --all-features --all-targets --target ${{ matrix.target }} -q --message-format=json | cargo-action-fmt + - name: Clippy + if: ${{ matrix.target != 'x86_64-unknown-linux-gnu' }} + run: cargo clippy --all-features --all-targets --target ${{ matrix.target }} + diff --git a/Cargo.toml b/Cargo.toml index ca54d8f4..a0b55163 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,5 +35,5 @@ style = "deny" complexity = "deny" perf = "deny" pedantic = "deny" -nursery = "allow" +nursery = "warn" restriction = "allow" diff --git a/src/config.rs b/src/config.rs index f0cee889..2d7fd601 100644 --- a/src/config.rs +++ b/src/config.rs @@ -202,13 +202,13 @@ mod tests { } impl TempEnvVar { - fn new(key: &OsStr, value: Option<&OsStr>) -> TempEnvVar { + fn new(key: &OsStr, value: Option<&OsStr>) -> Self { let orig_value = env::var_os(key); match value { Some(value) => env::set_var(key, value), None => env::remove_var(key), } - TempEnvVar { key: key.into(), orig_value } + Self { key: key.into(), orig_value } } } diff --git a/src/editor.rs b/src/editor.rs index 350efd68..82d3d1ea 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -263,7 +263,7 @@ impl Editor { (b'[' | b'O', Some(b'F')) => Key::End, (b'[', mut c @ Some(b'0'..=b'8')) => { let mut d = bytes.next().transpose()?; - if let (Some(b'1'), Some(b';')) = (c, d) { + if (c, d) == (Some(b'1'), Some(b';')) { // 1 is the default modifier value. Therefore, [1;5C is // equivalent to [5C, etc. c = bytes.next().transpose()?; @@ -942,12 +942,12 @@ mod tests { editor.insert_byte(*b); } editor.delete_char(); - assert_eq!(editor.rows[0].chars, "Hello world".as_bytes()); + assert_eq!(editor.rows[0].chars, b"Hello world"); editor.move_cursor(&AKey::Left, true); editor.move_cursor(&AKey::Left, false); editor.move_cursor(&AKey::Left, false); editor.delete_char(); - assert_eq!(editor.rows[0].chars, "Helo world".as_bytes()); + assert_eq!(editor.rows[0].chars, b"Helo world"); } #[test] diff --git a/src/row.rs b/src/row.rs index 7415b65b..baab6c0b 100644 --- a/src/row.rs +++ b/src/row.rs @@ -213,6 +213,6 @@ impl Row { } /// Return whether `c` is an ASCII separator. -fn is_sep(c: u8) -> bool { +const fn is_sep(c: u8) -> bool { c.is_ascii_whitespace() || c == b'\0' || (c.is_ascii_punctuation() && c != b'_') } diff --git a/src/wasi.rs b/src/wasi.rs index c19d5eae..cc04a5e4 100644 --- a/src/wasi.rs +++ b/src/wasi.rs @@ -11,24 +11,24 @@ pub struct TermMode {} /// Return the current window size as (rows, columns). /// By returning an error we cause kibi to fall back to another method of /// getting the window size -pub fn get_window_size() -> Result<(usize, usize), Error> { Err(Error::InvalidWindowSize) } +pub const fn get_window_size() -> Result<(usize, usize), Error> { Err(Error::InvalidWindowSize) } /// Register a signal handler that sets a global variable when the window size /// changes. On WASI platforms, this does nothing. #[allow(clippy::unnecessary_wraps)] // Result required on other platforms -pub fn register_winsize_change_signal_handler() -> Result<(), Error> { Ok(()) } +pub const fn register_winsize_change_signal_handler() -> Result<(), Error> { Ok(()) } /// Check if the windows size has changed since the last call to this function. /// On WASI platforms, this always return false. -pub fn has_window_size_changed() -> bool { false } +pub const fn has_window_size_changed() -> bool { false } /// Set the terminal mode. On WASI platforms, this does nothing. #[allow(clippy::unnecessary_wraps)] // Result required on other platforms -pub fn set_term_mode(_term: &TermMode) -> Result<(), Error> { Ok(()) } +pub const fn set_term_mode(_term: &TermMode) -> Result<(), Error> { Ok(()) } // Opening the file /dev/tty is effectively the same as `raw_mode` #[allow(clippy::unnecessary_wraps)] // Result required on other platforms -pub fn enable_raw_mode() -> Result { Ok(TermMode {}) } +pub const fn enable_raw_mode() -> Result { Ok(TermMode {}) } pub fn stdin() -> std::io::Result { std::fs::File::open("/dev/tty") } diff --git a/src/xdg.rs b/src/xdg.rs index b3c9cd50..069bcb36 100644 --- a/src/xdg.rs +++ b/src/xdg.rs @@ -6,7 +6,7 @@ use std::env::var; /// /// The XDG Base Directory Specification is defined here: /// -pub(crate) fn xdg_dirs(xdg_type: &str, def_home_suffix: &str, def_dirs: &str) -> Vec { +pub fn xdg_dirs(xdg_type: &str, def_home_suffix: &str, def_dirs: &str) -> Vec { let (home_key, dirs_key) = (format!("XDG_{xdg_type}_HOME"), format!("XDG_{xdg_type}_DIRS")); let mut dirs = Vec::new(); From 4f0d79c97e4ed6085c7a3d0408f6434d5a978b69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ila=C3=AF=20Deutel?= Date: Thu, 14 Nov 2024 21:27:20 -0500 Subject: [PATCH 44/65] Fix formatting and Clippy workflows outside of pull requests (#336) --- .github/workflows/ci.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 25b70600..3bd8e9e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -162,18 +162,21 @@ jobs: rustup override set nightly rustup target add --toolchain nightly ${{ matrix.target }} - name: Format - if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }} + if: ${{ github.event_name == 'pull_request' && matrix.target == 'x86_64-unknown-linux-gnu' }} uses: mbrobbel/rustfmt-check@master with: token: ${{ secrets.GITHUB_TOKEN }} mode: review + - name: Format + if: ${{ github.event_name != 'pull_request' || matrix.target == 'x86_64-unknown-linux-gnu' }} + run: cargo fmt --check - name: Set up cargo-action-fmt - if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }} + if: ${{ github.event_name == 'pull_request' && matrix.target == 'x86_64-unknown-linux-gnu' }} uses: olix0r/cargo-action-fmt/setup@v2 - name: Clippy - if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }} + if: ${{ github.event_name == 'pull_request' && matrix.target == 'x86_64-unknown-linux-gnu' }} run: cargo clippy --all-features --all-targets --target ${{ matrix.target }} -q --message-format=json | cargo-action-fmt - name: Clippy - if: ${{ matrix.target != 'x86_64-unknown-linux-gnu' }} + if: ${{ github.event_name != 'pull_request' || matrix.target != 'x86_64-unknown-linux-gnu' }} run: cargo clippy --all-features --all-targets --target ${{ matrix.target }} From b7167e7d20b165f56e4f30fab246ca2b77e11ee5 Mon Sep 17 00:00:00 2001 From: Josh McKinney Date: Fri, 15 Nov 2024 06:51:33 -0800 Subject: [PATCH 45/65] Replace Key::Page(PageKey) with Key::Page{Up,Down} (#331) Saves 4 LOG --- src/editor.rs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/editor.rs b/src/editor.rs index 82d3d1ea..0c5b84c8 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -35,7 +35,8 @@ macro_rules! set_status { ($editor:expr, $($arg:expr),*) => ($editor.status_msg enum Key { Arrow(AKey), CtrlArrow(AKey), - Page(PageKey), + PageUp, + PageDown, Home, End, Delete, @@ -51,12 +52,6 @@ enum AKey { Down, } -/// Enum of page keys -enum PageKey { - Up, - Down, -} - /// Describes the cursor position and the screen offset #[derive(Default, Clone)] struct CursorState { @@ -273,8 +268,8 @@ impl Editor { (Some(c), Some(b'~')) if c == b'1' || c == b'7' => Key::Home, (Some(c), Some(b'~')) if c == b'4' || c == b'8' => Key::End, (Some(b'3'), Some(b'~')) => Key::Delete, - (Some(b'5'), Some(b'~')) => Key::Page(PageKey::Up), - (Some(b'6'), Some(b'~')) => Key::Page(PageKey::Down), + (Some(b'5'), Some(b'~')) => Key::PageUp, + (Some(b'6'), Some(b'~')) => Key::PageDown, (Some(b'5'), Some(b'A')) => Key::CtrlArrow(AKey::Up), (Some(b'5'), Some(b'B')) => Key::CtrlArrow(AKey::Down), (Some(b'5'), Some(b'C')) => Key::CtrlArrow(AKey::Right), @@ -636,11 +631,11 @@ impl Editor { // TODO: CtrlArrow should move to next word Key::Arrow(arrow) => self.move_cursor(arrow, false), Key::CtrlArrow(arrow) => self.move_cursor(arrow, true), - Key::Page(PageKey::Up) => { + Key::PageUp => { self.cursor.y = self.cursor.roff.saturating_sub(self.screen_rows); self.update_cursor_x_position(); } - Key::Page(PageKey::Down) => { + Key::PageDown => { self.cursor.y = (self.cursor.roff + 2 * self.screen_rows - 1).min(self.rows.len()); self.update_cursor_x_position(); } @@ -727,7 +722,7 @@ impl Editor { self.file_name = None; } loop { - if let Some(mode) = self.prompt_mode.as_ref() { + if let Some(ref mode) = self.prompt_mode { set_status!(self, "{}", mode.status_msg()); } self.refresh_screen()?; From cc7ec3aa9cb85c2453106e54e8b90151ec7e294d Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Fri, 15 Nov 2024 10:04:25 -0500 Subject: [PATCH 46/65] add joshka as a contributor for code (#337) * update README.md [skip ci] * update .all-contributorsrc [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 3 ++- README.md | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index e82faa94..b032feb6 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -283,7 +283,8 @@ "avatar_url": "https://avatars.githubusercontent.com/u/381361?v=4", "profile": "http://joshka.net", "contributions": [ - "infra" + "infra", + "code" ] } ], diff --git a/README.md b/README.md index 28e20cc1..bd1cf3b8 100644 --- a/README.md +++ b/README.md @@ -383,7 +383,7 @@ any kind welcome!
Jan9103

💻 -
Josh McKinney

🚇 +
Josh McKinney

🚇 💻 From e02145f5dde8160a1593e112547b45e3d4d7568b Mon Sep 17 00:00:00 2001 From: Josh McKinney Date: Fri, 15 Nov 2024 07:06:37 -0800 Subject: [PATCH 47/65] Add vscode settings for using nightly rustfmt (#329) This makes vscode automatically use the correct formatting when saving --- .vscode/settings.json | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..a47cdf96 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "rust-analyzer.rustfmt.extraArgs": ["+nightly"] +} From d3a4843d2b05623e9137cf9c99b5e754560dbfb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ila=C3=AF=20Deutel?= Date: Sun, 17 Nov 2024 18:26:49 -0500 Subject: [PATCH 48/65] [CI] Update security workflows, add cargo-deny, deprecate cargo-audit (#338) --- .github/workflows/audit.yml | 17 --------------- .github/workflows/ci.yml | 6 +++++ .github/workflows/security.yml | 40 ++++++++++++++++++++++++++++++++++ .github/workflows/slscan.yml | 35 ----------------------------- Cargo.lock | 24 ++++++++++---------- deny.toml | 14 ++++++++++++ 6 files changed, 72 insertions(+), 64 deletions(-) delete mode 100644 .github/workflows/audit.yml create mode 100644 .github/workflows/security.yml delete mode 100644 .github/workflows/slscan.yml create mode 100644 deny.toml diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml deleted file mode 100644 index d9c1ebb1..00000000 --- a/.github/workflows/audit.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Security audit -on: - pull_request: - paths: - - '**/Cargo.toml' - - '**/Cargo.lock' - - '.github/workflows/audit.yml' - schedule: - - cron: '0 0 * * *' -jobs: - security_audit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions-rs/audit-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3bd8e9e9..51511a40 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,9 +4,15 @@ on: push: branches: - master + paths: + - '**.rs' + - '.github/workflows/ci.yml' pull_request: branches: - master + paths: + - '**.rs' + - '.github/workflows/ci.yml' env: CARGO_TERM_COLOR: always diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml new file mode 100644 index 00000000..a0899a75 --- /dev/null +++ b/.github/workflows/security.yml @@ -0,0 +1,40 @@ +name: Security + +on: + push: + branches: + - master + pull_request: + branches: + - master + schedule: + - cron: '22 17 * * 5' + +jobs: + dev-skim: + name: DevSkim + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run DevSkim scanner + uses: microsoft/DevSkim-Action@v1 + + - name: Upload DevSkim scan results to GitHub Security tab + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: devskim-results.sarif + cargo-deny: + name: Cargo Deny + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: EmbarkStudios/cargo-deny-action@v1 + with: + command-arguments: -D warnings + \ No newline at end of file diff --git a/.github/workflows/slscan.yml b/.github/workflows/slscan.yml deleted file mode 100644 index 45d0f5eb..00000000 --- a/.github/workflows/slscan.yml +++ /dev/null @@ -1,35 +0,0 @@ -# This workflow integrates Scan with GitHub's code scanning feature -# Scan is a free open-source security tool for modern DevOps teams from ShiftLeft -# Visit https://slscan.io/en/latest/integrations/code-scan for help -name: SL Scan - -on: - push: - branches: - - master - pull_request: - branches: - - master - schedule: - - cron: '22 17 * * 5' - -jobs: - Scan-Build: - # Scan runs on ubuntu, mac and windows - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Perform Scan - uses: ShiftLeftSecurity/scan-action@master - env: - WORKSPACE: "" - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SCAN_AUTO_BUILD: true - with: - output: reports - - - name: Upload report - uses: github/codeql-action/upload-sarif@v3 - with: - sarif_file: reports diff --git a/Cargo.lock b/Cargo.lock index 81f38128..bc5a6dc6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -59,9 +59,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -69,9 +69,9 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" @@ -86,27 +86,27 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", diff --git a/deny.toml b/deny.toml new file mode 100644 index 00000000..60668593 --- /dev/null +++ b/deny.toml @@ -0,0 +1,14 @@ +[graph] +all-features = true + +# This section is considered when running `cargo deny check licenses` +# More documentation for the licenses section can be found here: +# https://embarkstudios.github.io/cargo-deny/checks/licenses/cfg.html +[licenses] +# List of explicitly allowed licenses +# See https://spdx.org/licenses/ for list of possible licenses +# [possible values: any SPDX 3.11 short identifier (+ optional exception)]. +allow = [ + "MIT", + "Apache-2.0", +] From 50944c60b4666edb1b2693f49112dde0ea267c40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ila=C3=AF=20Deutel?= Date: Sun, 17 Nov 2024 22:52:24 -0500 Subject: [PATCH 49/65] Fix config parsing with invalid durations (#340) --- src/config.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/config.rs b/src/config.rs index 2d7fd601..884729c5 100644 --- a/src/config.rs +++ b/src/config.rs @@ -52,13 +52,12 @@ impl Config { for path in paths.iter().filter(|p| p.is_file()).rev() { process_ini_file(path, &mut |key, value| { match key { - "tab_stop" => match parse_value(value)? { - 0 => return Err("tab_stop must be > 0".into()), - tab_stop => conf.tab_stop = tab_stop, - }, + "tab_stop" => + conf.tab_stop = parse_value(value).map_err(|_| "tab_stop must be > 0")?, "quit_times" => conf.quit_times = parse_value(value)?, "message_duration" => - conf.message_dur = Duration::from_secs_f32(parse_value(value)?), + conf.message_dur = Duration::try_from_secs_f32(parse_value(value)?) + .map_err(|x| x.to_string())?, "show_line_numbers" => conf.show_line_num = parse_value(value)?, _ => return Err(format!("Invalid key: {key}")), }; From aa31bf9dc91e9c2c23a1835d5c0dbc472ec6e737 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ila=C3=AF=20Deutel?= Date: Mon, 18 Nov 2024 00:08:13 -0500 Subject: [PATCH 50/65] Bump MSRV to 1.80 (#343) --- .github/workflows/ci.yml | 8 +- Cargo.lock | 179 +++++++++++++-------------------------- Cargo.toml | 2 +- README.md | 2 +- src/row.rs | 3 +- 5 files changed, 65 insertions(+), 129 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 51511a40..c7e02d81 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,19 +49,19 @@ jobs: # MSRV (Linux) - os: ubuntu-latest target: x86_64-unknown-linux-gnu - toolchain: 1.66.0 + toolchain: "1.80" # MSRV (MacOS) - os: macos-latest target: x86_64-apple-darwin - toolchain: 1.66.0 + toolchain: "1.80" # MSRV (Windows) - os: windows-latest target: x86_64-pc-windows-gnu - toolchain: 1.66.0 + toolchain: "1.80" # MSRV (WASI) - os: ubuntu-latest target: wasm32-wasi - toolchain: 1.66.0 + toolchain: "1.80" runs-on: ${{ matrix.os }} diff --git a/Cargo.lock b/Cargo.lock index bc5a6dc6..8c336288 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,21 +4,15 @@ version = 3 [[package]] name = "autocfg" -version = "1.1.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" -version = "1.3.2" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "cfg-if" @@ -28,9 +22,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "errno" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ "libc", "windows-sys 0.52.0", @@ -38,15 +32,15 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" +checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" [[package]] name = "futures" -version = "0.3.28" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -75,9 +69,9 @@ checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -133,9 +127,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.162" +version = "0.2.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398" +checksum = "433bfe06b8c75da9b2e3fbea6e5329ff87748f0b144ef75306e674c3f6f7c13f" [[package]] name = "linux-raw-sys" @@ -145,9 +139,9 @@ checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "lock_api" -version = "0.4.10" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", @@ -155,15 +149,15 @@ dependencies = [ [[package]] name = "log" -version = "0.4.19" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "memchr" -version = "2.5.0" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "once_cell" @@ -173,9 +167,9 @@ checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "parking_lot" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core", @@ -183,22 +177,22 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.8" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-targets 0.48.1", + "windows-targets", ] [[package]] name = "pin-project-lite" -version = "0.2.10" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" [[package]] name = "pin-utils" @@ -208,38 +202,38 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.31" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] [[package]] name = "redox_syscall" -version = "0.3.5" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ - "bitflags 1.3.2", + "bitflags", ] [[package]] name = "rustix" -version = "0.38.37" +version = "0.38.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" +checksum = "99e4ea3e1cdc4b559b8e5650f9c8e5998e3e5c1343b4eaf034565f32318d63c0" dependencies = [ - "bitflags 2.4.1", + "bitflags", "errno", "libc", "linux-raw-sys", @@ -248,9 +242,9 @@ dependencies = [ [[package]] name = "scc" -version = "2.2.1" +version = "2.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "553f8299af7450cda9a52d3a370199904e7a46b5ffd1bef187c4a6af3bb6db69" +checksum = "66b202022bb57c049555430e11fc22fea12909276a80a4c3d368da36ac1d88ed" dependencies = [ "sdd", ] @@ -294,24 +288,24 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] [[package]] name = "smallvec" -version = "1.11.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.26" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45c3457aacde3c65315de5031ec191ce46604304d2446e803d71ade03308d970" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", @@ -320,9 +314,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" +checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", "fastrand", @@ -333,9 +327,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-width" @@ -380,7 +374,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.6", + "windows-targets", ] [[package]] @@ -389,22 +383,7 @@ version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-targets" -version = "0.48.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" -dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", + "windows-targets", ] [[package]] @@ -413,46 +392,28 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", "windows_i686_gnullvm", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" - [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" - [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" -[[package]] -name = "windows_i686_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" - [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -465,48 +426,24 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" -[[package]] -name = "windows_i686_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" - [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" - [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" - [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" - [[package]] name = "windows_x86_64_msvc" version = "0.52.6" diff --git a/Cargo.toml b/Cargo.toml index a0b55163..b86fa34d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "kibi" version = "0.2.2" -rust-version = "1.66" +rust-version = "1.80" authors = ["Ilaï Deutel"] license = "MIT OR Apache-2.0" edition = "2018" diff --git a/README.md b/README.md index bd1cf3b8..fb8c3d03 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Build Status](https://img.shields.io/github/actions/workflow/status/ilai-deutel/kibi/ci.yml?branch=master&logo=github-actions)](https://github.com/ilai-deutel/kibi/actions/workflows/ci.yml?query=branch%3Amaster) [![Lines of code](https://img.shields.io/github/actions/workflow/status/ilai-deutel/kibi/loc.yml?label=LOC%E2%89%A41024)](#) [![Crate](https://img.shields.io/crates/v/kibi.svg)](https://crates.io/crates/kibi) -[![Minimum rustc version](https://img.shields.io/badge/rustc-1.66+-blue.svg?logo=rust)](https://www.rust-lang.org/) +[![Minimum rustc version](https://img.shields.io/badge/rustc-1.80+-blue.svg?logo=rust)](https://www.rust-lang.org/) [![Platform](https://img.shields.io/badge/platform-Linux%20|%20macOS%20|%20Windows%2010%20|%20WASI-blue)](#) [![Packaging status](https://repology.org/badge/tiny-repos/kibi.svg)](https://repology.org/project/kibi/versions) [![Dependency Status](https://deps.rs/repo/github/ilai-deutel/kibi/status.svg)](https://deps.rs/repo/github/ilai-deutel/kibi) diff --git a/src/row.rs b/src/row.rs index baab6c0b..6568e046 100644 --- a/src/row.rs +++ b/src/row.rs @@ -92,8 +92,7 @@ impl Row { 'syntax_loop: while self.hl.len() < line.len() { let i = self.hl.len(); - let find_str = - |s: &str| line.get(i..(i + s.len())).map_or(false, |r| r.eq(s.as_bytes())); + let find_str = |s: &str| line.get(i..(i + s.len())).is_some_and(|r| r.eq(s.as_bytes())); if hl_state == HlState::Normal && syntax.sl_comment_start.iter().any(|s| find_str(s)) { self.hl.extend(repeat(HlType::Comment).take(line.len() - i)); From b5dcbf52c9658f74368fbc336769f93e50b140d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ila=C3=AF=20Deutel?= Date: Mon, 18 Nov 2024 00:17:31 -0500 Subject: [PATCH 51/65] [Tests] Remove dependency on serial_test, use Mutex instead (#341) This enables the use of sanitizers --- Cargo.lock | 246 -------------------------------------------------- Cargo.toml | 1 - src/config.rs | 10 +- 3 files changed, 6 insertions(+), 251 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8c336288..27cdfb86 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,12 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "autocfg" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" - [[package]] name = "bitflags" version = "2.6.0" @@ -36,89 +30,11 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" -[[package]] -name = "futures" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" - -[[package]] -name = "futures-executor" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" - -[[package]] -name = "futures-sink" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" - -[[package]] -name = "futures-task" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" - -[[package]] -name = "futures-util" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - [[package]] name = "kibi" version = "0.2.2" dependencies = [ "libc", - "serial_test", "tempfile", "unicode-width", "winapi", @@ -137,96 +53,12 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" -[[package]] -name = "lock_api" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" - -[[package]] -name = "memchr" -version = "2.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" - [[package]] name = "once_cell" version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" -[[package]] -name = "parking_lot" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "proc-macro2" -version = "1.0.89" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "redox_syscall" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" -dependencies = [ - "bitflags", -] - [[package]] name = "rustix" version = "0.38.40" @@ -240,78 +72,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "scc" -version = "2.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66b202022bb57c049555430e11fc22fea12909276a80a4c3d368da36ac1d88ed" -dependencies = [ - "sdd", -] - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "sdd" -version = "3.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49c1eeaf4b6a87c7479688c6d52b9f1153cedd3c489300564f932b065c6eab95" - -[[package]] -name = "serial_test" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b258109f244e1d6891bf1053a55d63a5cd4f8f4c30cf9a1280989f80e7a1fa9" -dependencies = [ - "futures", - "log", - "once_cell", - "parking_lot", - "scc", - "serial_test_derive", -] - -[[package]] -name = "serial_test_derive" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d69265a08751de7844521fd15003ae0a888e035773ba05695c5c759a6f89eef" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "slab" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - -[[package]] -name = "smallvec" -version = "1.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" - -[[package]] -name = "syn" -version = "2.0.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - [[package]] name = "tempfile" version = "3.14.0" @@ -325,12 +85,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "unicode-ident" -version = "1.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" - [[package]] name = "unicode-width" version = "0.2.0" diff --git a/Cargo.toml b/Cargo.toml index b86fa34d..8d22ce20 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,6 @@ winapi-util = "0.1.9" [dev-dependencies] tempfile = "3.13.0" -serial_test = "3.2.0" [badges] maintenance = { status = "actively-developed" } diff --git a/src/config.rs b/src/config.rs index 884729c5..b5ab2558 100644 --- a/src/config.rs +++ b/src/config.rs @@ -104,9 +104,9 @@ pub fn parse_values, E: Display>(value: &str) -> Result #[cfg(not(target_family = "wasm"))] // No filesystem on wasm mod tests { use std::ffi::{OsStr, OsString}; + #[cfg(unix)] use std::sync::{LazyLock, Mutex}; use std::{env, fs}; - use serial_test::serial; use tempfile::TempDir; use super::*; @@ -246,10 +246,13 @@ mod tests { assert_eq!(config, custom_config); } + #[cfg(unix)] + static XDG_CONFIG_FLAG_LOCK: LazyLock> = LazyLock::new(Mutex::default); + #[cfg(unix)] #[test] - #[serial] fn xdg_config_home() { + let _lock = XDG_CONFIG_FLAG_LOCK.lock(); let tmp_config_home = TempDir::new().expect("Could not create temporary directory"); test_config_dir( "XDG_CONFIG_HOME".as_ref(), @@ -260,8 +263,8 @@ mod tests { #[cfg(unix)] #[test] - #[serial] fn config_home() { + let _lock = XDG_CONFIG_FLAG_LOCK.lock(); let _temp_env_var = TempEnvVar::new(OsStr::new("XDG_CONFIG_HOME"), None); let tmp_home = TempDir::new().expect("Could not create temporary directory"); test_config_dir( @@ -273,7 +276,6 @@ mod tests { #[cfg(windows)] #[test] - #[serial] fn app_data() { let tmp_home = TempDir::new().expect("Could not create temporary directory"); test_config_dir( From c24668ba0ee7b10ec2474a29f6f27e74d86c824d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ila=C3=AF=20Deutel?= Date: Mon, 18 Nov 2024 00:20:24 -0500 Subject: [PATCH 52/65] Fix markdownlint errors in README.md --- .markdownlint.json | 9 --------- README.md | 15 +++++++-------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/.markdownlint.json b/.markdownlint.json index 3f38df6e..4711e71c 100644 --- a/.markdownlint.json +++ b/.markdownlint.json @@ -1,19 +1,10 @@ { - "MD003": { - "style": "atx" - }, "MD013": { "tables": false }, "MD024": { "siblings_only": true }, - "MD026": { - "punctuation": ".,;:!。,;:!" - }, - "MD029": { - "style": "ordered" - }, "MD033": { "allowed_elements": [ "details", diff --git a/README.md b/README.md index fb8c3d03..8006d53f 100644 --- a/README.md +++ b/README.md @@ -8,12 +8,11 @@ [![Packaging status](https://repology.org/badge/tiny-repos/kibi.svg)](https://repology.org/project/kibi/versions) [![Dependency Status](https://deps.rs/repo/github/ilai-deutel/kibi/status.svg)](https://deps.rs/repo/github/ilai-deutel/kibi) [![License](https://img.shields.io/crates/l/kibi?color=blue)](#license) -[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md) +[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md) [![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/ilai-deutel/kibi ) [![All Contributors](https://img.shields.io/badge/all_contributors-30-orange.svg)](#contributors) -Featured|HelloGitHub [![asciicast](assets/asciicast.gif)](https://asciinema.org/a/KY7tKPlxHXqRdJiv5KaTJbPj5) @@ -145,7 +144,6 @@ sudo dnf install kibi Kibi is available from [the official repos](https://cdn.netbsd.org/pub/pkgsrc/current/pkgsrc/editors/kibi/README.html). -
Installation instructions Install using: @@ -169,16 +167,17 @@ Kibi is available [on Flathub](https://flathub.org/ca/apps/com.github.ilai_deute
Command line instructions The flatpak can be installed using: - + ```bash flatpak install flathub com.github.ilai_deutel.kibi ``` You can then run Kibi with: - - ```bash - flatpak run com.github.ilai_deutel.kibi - ``` + +```bash +flatpak run com.github.ilai_deutel.kibi +``` +
## Usage From cf2dc81546ce2e61dc2b3970fe7a07e9bd7476d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ila=C3=AF=20Deutel?= Date: Mon, 18 Nov 2024 00:47:39 -0500 Subject: [PATCH 53/65] Delete .github/workflows/devskim.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ilaï Deutel --- .github/workflows/devskim.yml | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 .github/workflows/devskim.yml diff --git a/.github/workflows/devskim.yml b/.github/workflows/devskim.yml deleted file mode 100644 index 1822fc63..00000000 --- a/.github/workflows/devskim.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: DevSkim - -on: - push: - branches: - - master - pull_request: - branches: - - master - schedule: - - cron: '25 16 * * 1' - -jobs: - lint: - name: DevSkim - runs-on: ubuntu-20.04 - permissions: - actions: read - contents: read - security-events: write - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Run DevSkim scanner - uses: microsoft/DevSkim-Action@v1 - - - name: Upload DevSkim scan results to GitHub Security tab - uses: github/codeql-action/upload-sarif@v3 - with: - sarif_file: devskim-results.sarif From 2b9aa5d8c634d895d7107b0c7e3f8b1bc1271c6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ila=C3=AF=20Deutel?= Date: Mon, 18 Nov 2024 13:42:41 -0500 Subject: [PATCH 54/65] Add weekly sanitizer run to CI (#342) --- .github/workflows/ci.yml | 16 ++++----- .github/workflows/sanitizers.yml | 57 ++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/sanitizers.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c7e02d81..9f329eb8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,10 +76,10 @@ jobs: sudo apt-get update sudo apt-get install gcc-multilib - name: Install Rust toolchain - run: | - rustup toolchain install ${{ matrix.toolchain || 'stable' }} - rustup override set ${{ matrix.toolchain || 'stable' }} - rustup target add --toolchain ${{ matrix.toolchain || 'stable' }} ${{ matrix.target }} + uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ matrix.toolchain || 'stable' }} + targets: ${{ matrix.target }} - name: Build run: cargo build - name: Run tests @@ -163,10 +163,10 @@ jobs: steps: - uses: actions/checkout@v4 - name: Install nightly with clippy and rustfmt - run: | - rustup toolchain install nightly --component rustfmt --component clippy --allow-downgrade - rustup override set nightly - rustup target add --toolchain nightly ${{ matrix.target }} + uses: dtolnay/rust-toolchain@nightly + with: + targets: ${{ matrix.target }} + components: rustfmt, clippy - name: Format if: ${{ github.event_name == 'pull_request' && matrix.target == 'x86_64-unknown-linux-gnu' }} uses: mbrobbel/rustfmt-check@master diff --git a/.github/workflows/sanitizers.yml b/.github/workflows/sanitizers.yml new file mode 100644 index 00000000..6f137a6b --- /dev/null +++ b/.github/workflows/sanitizers.yml @@ -0,0 +1,57 @@ +name: Sanitizers + +on: + pull_request: + branches: + - master + paths: + - '.github/workflows/sanitizers.yml' + schedule: + - cron: '12 07 * * 2' # weekly on Tuesday + +jobs: + sanitizers: + strategy: + matrix: + sanitizer: + - address + - leak + - memory + - safestack + - thread + target: + - x86_64-unknown-linux-gnu + - x86_64-apple-darwin + include: + - target: x86_64-unknown-linux-gnu + os: ubuntu-latest + - target: x86_64-apple-darwin + os: macos-latest + - sanitizer: memory + extra_flags: -Zsanitizer-memory-track-origins + exclude: + # LeakSanitizer is not supported on MacOS + - sanitizer: leak + target: x86_64-apple-darwin + # MemorySanitizer is not supported on MacOS + - sanitizer: memory + target: x86_64-apple-darwin + # Safestack is not supported on MacOS + - sanitizer: safestack + target: x86_64-apple-darwin + + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@nightly + with: + targets: ${{ matrix.target }} + components: rust-src + - name: Run tests with sanitizer + run: cargo test -Zbuild-std --verbose --all-features --no-fail-fast --target ${{ matrix.target }} + env: + RUSTFLAGS: -D warnings -Zsanitizer=${{ matrix.sanitizer }} ${{ matrix.extra_flags }} + RUSTDOCFLAGS: -Zsanitizer=${{ matrix.sanitizer }} ${{ matrix.extra_flags }} From 2a5840eb33280d6512071a4b7585a5a5e50bb945 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ila=C3=AF=20Deutel?= Date: Mon, 18 Nov 2024 23:24:49 -0500 Subject: [PATCH 55/65] [CI] Temporarily stop using mbrobbel/rustfmt-check See https://github.com/mbrobbel/rustfmt-check/issues/1137 --- .github/workflows/ci.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9f329eb8..58447c22 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -168,13 +168,7 @@ jobs: targets: ${{ matrix.target }} components: rustfmt, clippy - name: Format - if: ${{ github.event_name == 'pull_request' && matrix.target == 'x86_64-unknown-linux-gnu' }} - uses: mbrobbel/rustfmt-check@master - with: - token: ${{ secrets.GITHUB_TOKEN }} - mode: review - - name: Format - if: ${{ github.event_name != 'pull_request' || matrix.target == 'x86_64-unknown-linux-gnu' }} + if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }} run: cargo fmt --check - name: Set up cargo-action-fmt if: ${{ github.event_name == 'pull_request' && matrix.target == 'x86_64-unknown-linux-gnu' }} From edcba1912c9d9130abcf96a161515a1c9d320ce5 Mon Sep 17 00:00:00 2001 From: Josh McKinney Date: Mon, 18 Nov 2024 20:34:42 -0800 Subject: [PATCH 56/65] Use module paths instead of conditional module includes for sys modules (#330) Saves 1 LOC --- src/lib.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 3736a6a0..96a7c817 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,13 +12,9 @@ mod row; mod syntax; mod terminal; -#[cfg(windows)] mod windows; -#[cfg(windows)] use windows as sys; - -#[cfg(unix)] mod unix; -#[cfg(unix)] use unix as sys; - -#[cfg(target_os = "wasi")] mod wasi; -#[cfg(target_os = "wasi")] use wasi as sys; +#[cfg_attr(windows, path = "windows.rs")] +#[cfg_attr(unix, path = "unix.rs")] +#[cfg_attr(target_os = "wasi", path = "wasi.rs")] +mod sys; #[cfg(any(unix, target_os = "wasi"))] mod xdg; From d9db9016abb5755d4ddc6ae9d795de2f484cbaec Mon Sep 17 00:00:00 2001 From: Josh McKinney Date: Tue, 19 Nov 2024 18:42:12 -0800 Subject: [PATCH 57/65] Replace count_loc.sh with xtask (#328) * Replace count_loc.sh with xtask To run the count_loc now, you can use `cargo xtask count-loc` instead of `./count_loc.sh`. See for more info on cargo-xtask. Fixes: https://github.com/ilai-deutel/kibi/issues/323 * Only check formatting on main package, not xtask There's a +nightly oddity where it returns an empty array twice instead of valid json for multiple projects, this causes the check action to fail --- .cargo/config.toml | 2 + .github/workflows/ci.yml | 15 +- .github/workflows/loc.yml | 16 +- .github/workflows/shellcheck.yml | 18 - Cargo.lock | 1398 +++++++++++++++++++++++++++++- Cargo.toml | 4 + README.md | 12 +- count_loc.sh | 67 -- xtask/Cargo.toml | 12 + xtask/src/count_loc.rs | 69 ++ xtask/src/main.rs | 40 + 11 files changed, 1518 insertions(+), 135 deletions(-) create mode 100644 .cargo/config.toml delete mode 100644 .github/workflows/shellcheck.yml delete mode 100755 count_loc.sh create mode 100644 xtask/Cargo.toml create mode 100644 xtask/src/count_loc.rs create mode 100644 xtask/src/main.rs diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 00000000..35049cbc --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[alias] +xtask = "run --package xtask --" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58447c22..e5b5b43c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,14 +5,14 @@ on: branches: - master paths: - - '**.rs' - - '.github/workflows/ci.yml' + - "**.rs" + - ".github/workflows/ci.yml" pull_request: branches: - master paths: - - '**.rs' - - '.github/workflows/ci.yml' + - "**.rs" + - ".github/workflows/ci.yml" env: CARGO_TERM_COLOR: always @@ -66,7 +66,7 @@ jobs: runs-on: ${{ matrix.os }} env: - RUSTFLAGS: '-D warnings' + RUSTFLAGS: "-D warnings" steps: - uses: actions/checkout@v4 @@ -105,7 +105,7 @@ jobs: runs-on: ${{ matrix.os }} env: - RUSTFLAGS: '-D warnings -C instrument-coverage' + RUSTFLAGS: "-D warnings -C instrument-coverage" steps: - uses: actions/checkout@v4 @@ -119,7 +119,7 @@ jobs: - name: Run tests with coverage instrumentation run: cargo test --verbose --all-features --no-fail-fast env: - LLVM_PROFILE_FILE: 'kibi-%p-%m.profraw' + LLVM_PROFILE_FILE: "kibi-%p-%m.profraw" - name: Collect code coverage results run: | cargo install grcov @@ -179,4 +179,3 @@ jobs: - name: Clippy if: ${{ github.event_name != 'pull_request' || matrix.target != 'x86_64-unknown-linux-gnu' }} run: cargo clippy --all-features --all-targets --target ${{ matrix.target }} - diff --git a/.github/workflows/loc.yml b/.github/workflows/loc.yml index 5f57c9e1..a01cd10d 100644 --- a/.github/workflows/loc.yml +++ b/.github/workflows/loc.yml @@ -1,21 +1,17 @@ on: pull_request: paths: - - '**.rs' - - 'count_loc.sh' - - '.github/workflows/loc.yml' + - "**.rs" + - ".github/workflows/loc.yml" -name: 'LOC' +name: LOC jobs: - check_lines_of_code: - runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 - - name: Install tokei - run: cargo install tokei + - name: Install rust + uses: dtolnay/rust-toolchain@stable - name: Check LOC <= 1024 - run: ./count_loc.sh + run: cargo xtask count-loc diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml deleted file mode 100644 index d88bba85..00000000 --- a/.github/workflows/shellcheck.yml +++ /dev/null @@ -1,18 +0,0 @@ -on: - pull_request: - paths: - - '**.sh' - - '.github/workflows/shellcheck.yml' - -name: 'ShellCheck' - -jobs: - shellcheck: - name: ShellCheck - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Run ShellCheck - uses: ludeeus/action-shellcheck@master - env: - SHELLCHECK_OPTS: --enable all diff --git a/Cargo.lock b/Cargo.lock index 27cdfb86..14a0d63f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,76 +2,1100 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "aho-corasick" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +dependencies = [ + "memchr", +] + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi", +] + +[[package]] +name = "anstream" +version = "0.6.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" + +[[package]] +name = "anstyle-parse" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" +dependencies = [ + "anstyle", + "windows-sys 0.59.0", +] + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi 0.1.19", + "libc", + "winapi", +] + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "bitflags" version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bstr" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a68f1f47cdf0ec8ee4b941b2eee2a80cb796db73118c0dd09ac63fbe405be22" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "cc" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47" +dependencies = [ + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "num-traits", + "windows-targets", +] + +[[package]] +name = "chrono-tz" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93698b29de5e97ad0ae26447b344c482a7284c737d9ddc5f9e52b74a336671bb" +dependencies = [ + "chrono", + "chrono-tz-build", + "phf", +] + +[[package]] +name = "chrono-tz-build" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c088aee841df9c3041febbb73934cfc39708749bf96dc827e3359cd39ef11b1" +dependencies = [ + "parse-zoneinfo", + "phf", + "phf_codegen", +] + +[[package]] +name = "clap" +version = "2.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +dependencies = [ + "ansi_term", + "atty", + "bitflags 1.3.2", + "strsim 0.8.0", + "textwrap", + "unicode-width 0.1.14", + "vec_map", +] + +[[package]] +name = "clap" +version = "4.5.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim 0.11.1", +] + +[[package]] +name = "clap_derive" +version = "4.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7" + +[[package]] +name = "colorchoice" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ca741a962e1b0bff6d724a1a0958b686406e853bb14061f218562e1896f95e6" +dependencies = [ + "libc", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "dashmap" +version = "4.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c" +dependencies = [ + "cfg-if", + "num_cpus", + "serde", +] + +[[package]] +name = "deunicode" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339544cc9e2c4dc3fc7149fd630c5f22263a4fdf18a98afd0075784968b5cf00" + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "dirs" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30baa043103c9d0c2a57cf537cc2f35623889dc0d405e6c3cccfadbc81c71309" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "encoding_rs_io" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cc3c5651fb62ab8aa3103998dade57efdd028544bd300516baa31840c252a83" +dependencies = [ + "encoding_rs", +] + +[[package]] +name = "env_logger" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "fastrand" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "globset" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19" +dependencies = [ + "aho-corasick 1.1.3", + "bstr", + "log", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "globwalk" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf760ebf69878d9fd8f110c89703d90ce35095324d1f1edcb595c63945ee757" +dependencies = [ + "bitflags 2.6.0", + "ignore", + "walkdir", +] + +[[package]] +name = "grep-matcher" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47a3141a10a43acfedc7c98a60a834d7ba00dfe7bec9071cbfc19b55b292ac02" +dependencies = [ + "memchr", +] + +[[package]] +name = "grep-searcher" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9b6c14b3fc2e0a107d6604d3231dec0509e691e62447104bc385a46a7892cda" +dependencies = [ + "bstr", + "encoding_rs", + "encoding_rs_io", + "grep-matcher", + "log", + "memchr", + "memmap2", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "humansize" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6cb51c9a029ddc91b07a787f1d86b53ccfa49b0e86688c946ebe8d3555685dd7" +dependencies = [ + "libm", +] + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "iana-time-zone" +version = "0.1.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "ignore" +version = "0.4.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d89fd380afde86567dfba715db065673989d6253f42b88179abd3eae47bda4b" +dependencies = [ + "crossbeam-deque", + "globset", + "log", + "memchr", + "regex-automata", + "same-file", + "walkdir", + "winapi-util", +] + +[[package]] +name = "instant" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "js-sys" +version = "0.3.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "kibi" +version = "0.2.2" +dependencies = [ + "libc", + "tempfile", + "unicode-width 0.2.0", + "winapi", + "winapi-util", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.164" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "433bfe06b8c75da9b2e3fbea6e5329ff87748f0b144ef75306e674c3f6f7c13f" + +[[package]] +name = "libm" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" + +[[package]] +name = "libredox" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags 2.6.0", + "libc", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "memmap2" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3f7eed9d3848f8b98834af67102b720745c4ec028fcd0aa0239277e7de374f" +dependencies = [ + "libc", +] + +[[package]] +name = "num-format" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" +dependencies = [ + "arrayvec", + "itoa", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi 0.3.9", + "libc", +] + +[[package]] +name = "once_cell" +version = "1.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" + +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall", + "smallvec", + "winapi", +] + +[[package]] +name = "parse-zoneinfo" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f2a05b18d44e2957b88f96ba460715e295bc1d7510468a2f3d3b44535d26c24" +dependencies = [ + "regex", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pest" +version = "2.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d214365f632b123a47fd913301e14c946c61d1c183ee245fa76eb752e59a02dd" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb55586734301717aea2ac313f50b2eb8f60d2fc3dc01d190eefa2e625f60c4e" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pest_meta" +version = "2.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b75da2a70cf4d9cb76833c990ac9cd3923c9a8905a8929789ce347c84564d03d" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + +[[package]] +name = "phf" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +dependencies = [ + "phf_shared", +] + +[[package]] +name = "phf_codegen" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a" +dependencies = [ + "phf_generator", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" +dependencies = [ + "phf_shared", + "rand", +] + +[[package]] +name = "phf_shared" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +dependencies = [ + "siphasher", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro2" +version = "1.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] [[package]] -name = "cfg-if" -version = "1.0.0" +name = "rand_chacha" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] [[package]] -name = "errno" -version = "0.3.9" +name = "rand_core" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "libc", - "windows-sys 0.52.0", + "getrandom", ] [[package]] -name = "fastrand" -version = "2.2.0" +name = "rayon" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +dependencies = [ + "either", + "rayon-core", +] [[package]] -name = "kibi" -version = "0.2.2" +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ - "libc", - "tempfile", - "unicode-width", - "winapi", - "winapi-util", + "crossbeam-deque", + "crossbeam-utils", ] [[package]] -name = "libc" -version = "0.2.164" +name = "redox_syscall" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433bfe06b8c75da9b2e3fbea6e5329ff87748f0b144ef75306e674c3f6f7c13f" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags 1.3.2", +] [[package]] -name = "linux-raw-sys" -version = "0.4.14" +name = "redox_users" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" +dependencies = [ + "getrandom", + "libredox", + "thiserror", +] [[package]] -name = "once_cell" -version = "1.20.2" +name = "regex" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +dependencies = [ + "aho-corasick 1.1.3", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +dependencies = [ + "aho-corasick 1.1.3", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "rustix" -version = "0.38.40" +version = "0.38.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99e4ea3e1cdc4b559b8e5650f9c8e5998e3e5c1343b4eaf034565f32318d63c0" +checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6" dependencies = [ - "bitflags", + "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", "windows-sys 0.52.0", ] +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "serde" +version = "1.0.215" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.215" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.133" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + +[[package]] +name = "slug" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "882a80f72ee45de3cc9a5afeb2da0331d58df69e4e7d8eeb5d3c7784ae67e724" +dependencies = [ + "deunicode", + "wasm-bindgen", +] + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "strsim" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "syn" +version = "2.0.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "tempfile" version = "3.14.0" @@ -85,12 +1109,282 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "tera" +version = "1.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab9d851b45e865f178319da0abdbfe6acbc4328759ff18dafc3a41c16b4cd2ee" +dependencies = [ + "chrono", + "chrono-tz", + "globwalk", + "humansize", + "lazy_static", + "percent-encoding", + "pest", + "pest_derive", + "rand", + "regex", + "serde", + "serde_json", + "slug", + "unic-segment", +] + +[[package]] +name = "term_size" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +dependencies = [ + "unicode-width 0.1.14", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokei" +version = "12.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a41f915e075a8a98ad64a5f7be6b7cc1710fc835c5f07e4a3efcaeb013291c00" +dependencies = [ + "aho-corasick 0.7.20", + "clap 2.34.0", + "crossbeam-channel", + "dashmap", + "dirs", + "encoding_rs_io", + "env_logger", + "grep-searcher", + "ignore", + "log", + "num-format", + "once_cell", + "parking_lot", + "rayon", + "regex", + "serde", + "serde_json", + "tera", + "term_size", + "toml", +] + +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + +[[package]] +name = "unic-char-property" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8c57a407d9b6fa02b4795eb81c5b6652060a15a7903ea981f3d723e6c0be221" +dependencies = [ + "unic-char-range", +] + +[[package]] +name = "unic-char-range" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0398022d5f700414f6b899e10b8348231abf9173fa93144cbc1a43b9793c1fbc" + +[[package]] +name = "unic-common" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc" + +[[package]] +name = "unic-segment" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4ed5d26be57f84f176157270c112ef57b86debac9cd21daaabbe56db0f88f23" +dependencies = [ + "unic-ucd-segment", +] + +[[package]] +name = "unic-ucd-segment" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2079c122a62205b421f499da10f3ee0f7697f012f55b675e002483c73ea34700" +dependencies = [ + "unic-char-property", + "unic-char-range", + "unic-ucd-version", +] + +[[package]] +name = "unic-ucd-version" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96bd2f2237fe450fcd0a1d2f5f4e91711124f7857ba2e964247776ebeeb7b0c4" +dependencies = [ + "unic-common", +] + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" + +[[package]] +name = "unicode-width" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + [[package]] name = "unicode-width" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "vec_map" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" +dependencies = [ + "cfg-if", + "once_cell", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" + [[package]] name = "winapi" version = "0.3.9" @@ -122,6 +1416,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets", +] + [[package]] name = "windows-sys" version = "0.52.0" @@ -203,3 +1506,36 @@ name = "windows_x86_64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "xtask" +version = "0.1.0" +dependencies = [ + "anstream", + "anstyle", + "clap 4.5.21", + "glob", + "regex", + "tokei", +] + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/Cargo.toml b/Cargo.toml index 8d22ce20..5c588212 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,7 @@ +[workspace] +resolver = "2" +members = ["xtask"] + [package] name = "kibi" version = "0.2.2" diff --git a/README.md b/README.md index 8006d53f..81d282b1 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Contributions are welcome! Be careful to stay below the 1024-line limit... 1.: Counted per platform, excluding tests and -Clippy directives, see [`count_loc.sh`](count_loc.sh) \ +Clippy directives, see [`count_loc`](./xtask/src/count_loc.rs) \ 2.: Kibi requires the terminal to support ANSI escape sequences. Windows 10 version 1703 ([Creators Update](https://devblogs.microsoft.com/commandline/windows-10-creators-update-whats-new-in-bashwsl-windows-console), April 2017) and above are supported. @@ -52,6 +52,7 @@ April 2017) and above are supported. * [Global configuration](#global-configuration) * [Syntax highlighting](#syntax-highlighting) * [Comparison with kilo](#comparison-with-kilo) +* [Contributing](#contributing) * [Dependencies](#dependencies) * [Why Kibi?](#why-kibi) * [Contributors](#contributors) @@ -306,6 +307,15 @@ editor written by Salvatore Sanfilippo (antirez) in C, and * Memory safety, thanks to Rust! * Many bug fixes +## Contributing + +The most important limitation is that the line check the line count remains +under 1024. To check this run: + +```shell +cargo xtask count-loc +``` + ## Dependencies This project must remain tiny, so using advanced dependencies such as [`ncurses`](https://crates.io/crates/ncurses), diff --git a/count_loc.sh b/count_loc.sh deleted file mode 100755 index eafa2e0c..00000000 --- a/count_loc.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env bash - -# Count the number of lines of code in kibi source code, display a result -# table. Exit code 0 will be returned if the total LOC count is below 1024. - -# The lines of codes are counted using `tokei`, after removing the following -# from the code: -# * Clippy directives -# * Anything after #[cfg(test)] - -set -euo pipefail - -declare -i file_loc total_loc left_col_width -declare -A file_locs per_platform_total_locs - -paths=("$(dirname "${BASH_SOURCE[0]:-$0}")/"{.,src}/*.rs) - -left_col_width=6 -per_platform_total_locs['unix']=0 -per_platform_total_locs['wasi']=0 -per_platform_total_locs['windows']=0 - -for path in "${paths[@]}"; do - if (( ${#path} > left_col_width )); then left_col_width=${#path}; fi; - - tempfile=$(mktemp --suffix .rs) - # Ignore Clippy directives - code=$(grep -v -P '^\s*#!?\[(?:allow|warn|deny)\(clippy::' "${path}") - # Ignore everything after #[cfg(test)] - echo "${code%'#[cfg(test)]'*}" > "${tempfile}" - file_loc=$(tokei "${tempfile}" -t=Rust -o json | jq .Rust.code) - rm "${tempfile}" - - file_locs[${path}]=${file_loc} - - if [[ "${path}" == "./src/unix.rs" ]]; then - per_platform_total_locs['unix']=$((per_platform_total_locs['unix'] + file_loc)) - elif [[ "${path}" == "./src/wasi.rs" ]]; then - per_platform_total_locs['wasi']=$((per_platform_total_locs['wasi'] + file_loc)) - elif [[ "${path}" == "./src/windows.rs" ]]; then - per_platform_total_locs['windows']=$((per_platform_total_locs['windows'] + file_loc)) - else - for platform in "${!per_platform_total_locs[@]}"; do - per_platform_total_locs[${platform}]=$((per_platform_total_locs[${platform}] + file_loc)) - done - fi -done - -for path in "${paths[@]}"; do - printf "%-${left_col_width}s %4i\n" "${path}" "${file_locs[${path}]}" -done - -loc_too_high=false -for platform in "${!per_platform_total_locs[@]}"; do - total_loc=${per_platform_total_locs[${platform}]} - printf "%b%-${left_col_width}s %4i %b" '\x1b[1m' "Total (${platform})" "${total_loc}" '\x1b[0m' - if [[ ${total_loc} -gt 1024 ]]; then - echo -e ' \x1b[31m(> 1024)\x1b[0m' - loc_too_high=true - else - echo -e ' \x1b[32m(≤ 1024)\x1b[0m' - fi -done - -if [[ ${loc_too_high} = true ]]; then - exit 1 -fi diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml new file mode 100644 index 00000000..3864f5d5 --- /dev/null +++ b/xtask/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "xtask" +version = "0.1.0" +edition = "2021" + +[dependencies] +anstream = "0.6.18" +anstyle = "1.0.10" +clap = { version = "4.5.21", features = ["derive"] } +glob = "0.3.1" +regex = { version = "1.11.1" } +tokei = "12.1.2" diff --git a/xtask/src/count_loc.rs b/xtask/src/count_loc.rs new file mode 100644 index 00000000..d3a14a69 --- /dev/null +++ b/xtask/src/count_loc.rs @@ -0,0 +1,69 @@ +use std::path::PathBuf; + +use anstream::println; +use glob::glob; +use regex::Regex; +use tokei::LanguageType; + +use crate::{BOLD, GREEN, RED, RESET, Result}; + +pub fn count_loc() -> Result<()> { + let mut results = Vec::new(); + let config = tokei::Config::default(); + let mut longest_path = 0; + for entry in glob("./*.rs")?.chain(glob("./src/**/*.rs")?) { + let path = entry?; + + let source = filter_lines(&path)?; + let stats = LanguageType::Rust.parse_from_str(source, &config); + + longest_path = longest_path.max(path.display().to_string().len()); + results.push((path, stats.code)); + } + print_summary(&results, longest_path, &["unix", "wasi", "windows"]) +} + +/// Filter out lines that contain `clippy` lints and anything after +/// `#[cfg(test)]` attributes. +pub fn filter_lines(path: &std::path::PathBuf) -> Result { + let regex = Regex::new(r"^\s*#!?\[(?:allow|warn|deny)\(clippy::")?; + let content = std::fs::read_to_string(path)?; + let lines = content + .lines() + .filter(|line| !regex.is_match(line)) + .take_while(|line| !line.contains("#[cfg(test)]")); + let filtered_content = lines.collect::>().join("\n"); + Ok(filtered_content) +} + +pub fn print_summary(results: &[(PathBuf, usize)], width: usize, platforms: &[&str]) -> Result<()> { + let platform_counts = platforms.iter().map(|platform| filter_count(results, platform)); + let other_count = results.iter().map(|(_, count)| count).sum::() + - platform_counts.clone().sum::(); + for (path, count) in results { + println!("{:width$} {:4}", path.display(), count, width = width); + } + let mut too_high = false; + for (platform, platform_count) in platforms.iter().zip(platform_counts) { + let header = format!("Total ({platform})"); + let total = platform_count + other_count; + if total > 1024 { + too_high = true; + println!("{BOLD}{header:width$} {total:4}{RESET} {RED}(> 1024){RESET}"); + } else { + println!("{BOLD}{header:width$} {total:4}{RESET} {GREEN}(≤ 1024){RESET}"); + } + } + if too_high { + Err("Total count is too high")?; + } + Ok(()) +} + +pub fn filter_count(results: &[(std::path::PathBuf, usize)], pattern: &str) -> usize { + results + .iter() + .filter(|(path, _)| path.display().to_string().contains(pattern)) + .map(|(_, count)| count) + .sum::() +} diff --git a/xtask/src/main.rs b/xtask/src/main.rs new file mode 100644 index 00000000..da95d597 --- /dev/null +++ b/xtask/src/main.rs @@ -0,0 +1,40 @@ +use std::io::Write; + +use anstyle::{AnsiColor, Reset, Style}; +use clap::{Parser, Subcommand}; +mod count_loc; + +type Result> = std::result::Result; + +const BOLD: Style = Style::new().bold(); +const RESET: Reset = Reset; +const RED: Style = AnsiColor::Red.on_default(); +const GREEN: Style = AnsiColor::Green.on_default(); + +fn main() { + let args = Args::parse(); + if let Err(err) = args.command.execute() { + let _ = std::io::stdout().flush(); + eprintln!("{RED}{err}{RESET}"); + std::process::exit(1); + } +} + +#[derive(Debug, Parser)] +struct Args { + #[command(subcommand)] + command: Command, +} + +#[derive(Debug, Subcommand)] +enum Command { + CountLoc, +} + +impl Command { + fn execute(&self) -> Result<()> { + match self { + Command::CountLoc => count_loc::count_loc(), + } + } +} From 5eff635520b689f13f16d3a74de8950e9edf8e9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ila=C3=AF=20Deutel?= Date: Sat, 23 Nov 2024 22:42:08 -0500 Subject: [PATCH 58/65] [xtask] Add more info to Cargo.toml (#344) --- Cargo.toml | 4 +++- xtask/Cargo.toml | 9 +++++++++ xtask/README.md | 13 +++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 xtask/README.md diff --git a/Cargo.toml b/Cargo.toml index 5c588212..a2a0bc2d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,11 +32,13 @@ tempfile = "3.13.0" [badges] maintenance = { status = "actively-developed" } -[lints.clippy] +[workspace.lints.clippy] correctness = "deny" style = "deny" complexity = "deny" perf = "deny" pedantic = "deny" +cargo = "deny" +suspicious = "warn" nursery = "warn" restriction = "allow" diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index 3864f5d5..86923fbc 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -2,6 +2,12 @@ name = "xtask" version = "0.1.0" edition = "2021" +description = "Scripts to help with kibi's development." +license = "MIT OR Apache-2.0" +repository = "https://github.com/ilai-deutel/kibi" +readme = "README.md" +keywords = ["scripts"] +categories = ["development-tools"] [dependencies] anstream = "0.6.18" @@ -10,3 +16,6 @@ clap = { version = "4.5.21", features = ["derive"] } glob = "0.3.1" regex = { version = "1.11.1" } tokei = "12.1.2" + +[lints] +workspace = true diff --git a/xtask/README.md b/xtask/README.md new file mode 100644 index 00000000..a0dc0552 --- /dev/null +++ b/xtask/README.md @@ -0,0 +1,13 @@ +# kibi xtask scripts + +Scripts to help with kibi's development. + +## count_loc + +Verify that the number of source code lines falls below the limit. + +Usage: + +```bash +cargo xtask count_loc +``` \ No newline at end of file From 382b422949dd6ee0fa7393cd893c008d8246093d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ila=C3=AF=20Deutel?= Date: Sat, 23 Nov 2024 22:49:00 -0500 Subject: [PATCH 59/65] Fix lint config for main crate --- Cargo.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index a2a0bc2d..d0aba7ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,6 +32,9 @@ tempfile = "3.13.0" [badges] maintenance = { status = "actively-developed" } +[lints] +workspace = true + [workspace.lints.clippy] correctness = "deny" style = "deny" From 745622508ac4b1a9ce35e88f5a46a6870930206f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ila=C3=AF=20Deutel?= Date: Tue, 26 Nov 2024 10:12:51 -0500 Subject: [PATCH 60/65] Remove obsolete TODO MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ilaï Deutel --- src/editor.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/editor.rs b/src/editor.rs index 0c5b84c8..0cab5539 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -628,7 +628,6 @@ impl Editor { let mut prompt_mode = None; match key { - // TODO: CtrlArrow should move to next word Key::Arrow(arrow) => self.move_cursor(arrow, false), Key::CtrlArrow(arrow) => self.move_cursor(arrow, true), Key::PageUp => { From 7bedad6570009c9c2f02ce7bf2cb9666cd035437 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ila=C3=AF=20Deutel?= Date: Tue, 26 Nov 2024 10:55:23 -0500 Subject: [PATCH 61/65] Add more lints to check and clippy configuration (#345) --- .github/workflows/ci.yml | 12 ++++-- Cargo.toml | 83 +++++++++++++++++++++++++++++++++++----- clippy.toml | 3 ++ src/config.rs | 4 +- src/editor.rs | 5 ++- src/row.rs | 4 +- src/terminal.rs | 2 +- src/unix.rs | 4 +- src/wasi.rs | 2 +- src/windows.rs | 2 +- xtask/src/count_loc.rs | 10 ++--- xtask/src/main.rs | 17 ++++---- 12 files changed, 115 insertions(+), 33 deletions(-) create mode 100644 clippy.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e5b5b43c..75d613a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -169,13 +169,19 @@ jobs: components: rustfmt, clippy - name: Format if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }} - run: cargo fmt --check + run: cargo fmt --check --all - name: Set up cargo-action-fmt if: ${{ github.event_name == 'pull_request' && matrix.target == 'x86_64-unknown-linux-gnu' }} uses: olix0r/cargo-action-fmt/setup@v2 + - name: Check + if: ${{ github.event_name == 'pull_request' && matrix.target == 'x86_64-unknown-linux-gnu' }} + run: cargo check --all-features --all-targets --workspace --target ${{ matrix.target }} -q --message-format=json | cargo-action-fmt + - name: Check + if: ${{ github.event_name != 'pull_request' || matrix.target != 'x86_64-unknown-linux-gnu' }} + run: cargo check --all-features --all-targets --workspace --target ${{ matrix.target }} - name: Clippy if: ${{ github.event_name == 'pull_request' && matrix.target == 'x86_64-unknown-linux-gnu' }} - run: cargo clippy --all-features --all-targets --target ${{ matrix.target }} -q --message-format=json | cargo-action-fmt + run: cargo clippy --all-features --all-targets --workspace --target ${{ matrix.target }} -q --message-format=json | cargo-action-fmt - name: Clippy if: ${{ github.event_name != 'pull_request' || matrix.target != 'x86_64-unknown-linux-gnu' }} - run: cargo clippy --all-features --all-targets --target ${{ matrix.target }} + run: cargo clippy --all-features --all-targets --workspace --target ${{ matrix.target }} diff --git a/Cargo.toml b/Cargo.toml index d0aba7ea..48943b96 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,13 +35,78 @@ maintenance = { status = "actively-developed" } [lints] workspace = true +[workspace.lints.rust] +explicit_outlives_requirements = "deny" +let-underscore-drop = "deny" +meta-variable-misuse = "deny" +non_ascii_idents = "deny" +non-local-definitions = "deny" +redundant-imports = "deny" +redundant-lifetimes = "deny" +single-use-lifetimes = "deny" +trivial-casts = "deny" +trivial_numeric_casts = "deny" +unit-bindings = "deny" +unnameable-types = "deny" +unsafe-code = "deny" # Will only be allowed in platform-specific modules +unused-import-braces = "deny" +unused-lifetimes = "deny" +unused-macro-rules = "deny" +unused_qualifications = "deny" +variant_size_differences = "deny" + [workspace.lints.clippy] -correctness = "deny" -style = "deny" -complexity = "deny" -perf = "deny" -pedantic = "deny" -cargo = "deny" -suspicious = "warn" -nursery = "warn" -restriction = "allow" +correctness = { level = "deny", priority = -1 } +style = { level = "deny", priority = -1 } +complexity = { level = "deny", priority = -1 } +perf = { level = "deny", priority = -1 } +pedantic = { level = "deny", priority = -1 } +cargo = { level = "deny", priority = -1 } +suspicious = { level = "warn", priority = -1 } +nursery = { level = "warn", priority = -1 } + +restriction = { level = "allow", priority = -1 } +allow_attributes = "deny" +as_underscore = "deny" +assertions_on_result_states = "deny" +cfg_not_test = "deny" +clone_on_ref_ptr = "deny" +create_dir = "deny" +dbg_macro = "deny" +empty_drop = "deny" +empty_enum_variants_with_brackets = "deny" +empty_structs_with_brackets = "deny" +exit = "deny" +expect_used = "deny" +float_cmp_const = "deny" +fn_to_numeric_cast_any = "deny" +format_push_string = "deny" +get_unwrap = "deny" +if_then_some_else_none = "deny" +impl_trait_in_params = "deny" +infinite_loop = "deny" +map_with_unused_argument_over_ranges = "deny" +mem_forget = "deny" +missing_assert_message = "deny" +mixed_read_write_in_expression = "deny" +mod_module_files = "deny" +module_name_repetitions = "deny" +multiple_inherent_impl = "deny" +mutex_atomic = "deny" +needless_raw_strings = "deny" +panic = "deny" +rc_buffer = "deny" +rc_mutex = "deny" +redundant_type_annotations = "deny" +ref_patterns = "deny" +renamed_function_params = "deny" +rest_pat_in_fully_bound_structs = "deny" +same_name_method = "deny" +semicolon_outside_block = "deny" +separated_literal_suffix = "deny" +str_to_string = "deny" +unused_result_ok = "deny" +unwrap_used = "deny" +use_debug = "deny" +verbose_file_reads = "deny" +wildcard_enum_match_arm = "deny" \ No newline at end of file diff --git a/clippy.toml b/clippy.toml new file mode 100644 index 00000000..c64d65f8 --- /dev/null +++ b/clippy.toml @@ -0,0 +1,3 @@ +allow-expect-in-tests = true +allow-panic-in-tests = true +allow-unwrap-in-tests = true diff --git a/src/config.rs b/src/config.rs index b5ab2558..948d1fd6 100644 --- a/src/config.rs +++ b/src/config.rs @@ -213,8 +213,8 @@ mod tests { impl Drop for TempEnvVar { fn drop(&mut self) { - match self.orig_value { - Some(ref orig_value) => env::set_var(&self.key, orig_value), + match &self.orig_value { + Some(orig_value) => env::set_var(&self.key, orig_value), None => env::remove_var(&self.key), } } diff --git a/src/editor.rs b/src/editor.rs index 0cab5539..94263214 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -721,7 +721,7 @@ impl Editor { self.file_name = None; } loop { - if let Some(ref mode) = self.prompt_mode { + if let Some(mode) = &self.prompt_mode { set_status!(self, "{}", mode.status_msg()); } self.refresh_screen()?; @@ -740,6 +740,7 @@ impl Editor { } impl Drop for Editor { + #[allow(clippy::expect_used)] /// When the editor is dropped, restore the original terminal mode. fn drop(&mut self) { if let Some(orig_term_mode) = self.orig_term_mode.take() { @@ -792,6 +793,7 @@ impl PromptMode { } match process_prompt_keypress(b, key) { PromptState::Active(query) => { + #[allow(clippy::wildcard_enum_match_arm)] let (last_match, forward) = match key { Key::Arrow(AKey::Right | AKey::Down) | Key::Char(FIND) => (last_match, true), @@ -860,6 +862,7 @@ enum PromptState { /// Process a prompt keypress event and return the new state for the prompt. fn process_prompt_keypress(mut buffer: String, key: &Key) -> PromptState { + #[allow(clippy::wildcard_enum_match_arm)] match key { Key::Char(b'\r') => return PromptState::Completed(buffer), Key::Escape | Key::Char(EXIT) => return PromptState::Cancelled, diff --git a/src/row.rs b/src/row.rs index 6568e046..f7cbe13d 100644 --- a/src/row.rs +++ b/src/row.rs @@ -64,8 +64,8 @@ impl Row { // The number of rendered characters let n_rend_chars = if c == '\t' { tab - (rx % tab) } else { c.width().unwrap_or(1) }; self.render.push_str(&(if c == '\t' { " ".repeat(n_rend_chars) } else { c.into() })); - self.cx2rx.extend(std::iter::repeat(rx).take(c.len_utf8())); - self.rx2cx.extend(std::iter::repeat(cx).take(n_rend_chars)); + self.cx2rx.extend(repeat(rx).take(c.len_utf8())); + self.rx2cx.extend(repeat(cx).take(n_rend_chars)); (rx, cx) = (rx + n_rend_chars, cx + c.len_utf8()); } let (..) = (self.cx2rx.push(rx), self.rx2cx.push(cx)); diff --git a/src/terminal.rs b/src/terminal.rs index 753cec9e..b09f2a91 100644 --- a/src/terminal.rs +++ b/src/terminal.rs @@ -15,7 +15,7 @@ pub fn get_window_size_using_cursor() -> Result<(usize, usize), Error> { let mut stdin = sys::stdin()?; print!("{REPOSITION_CURSOR_END}{DEVICE_STATUS_REPORT}"); io::stdout().flush()?; - let mut prefix_buffer = [0_u8; 2]; + let mut prefix_buffer = [0u8; 2]; stdin.read_exact(&mut prefix_buffer)?; if prefix_buffer != [b'\x1b', b'['] { return Err(Error::CursorPosition); diff --git a/src/unix.rs b/src/unix.rs index 126c04bf..3019be44 100644 --- a/src/unix.rs +++ b/src/unix.rs @@ -2,6 +2,7 @@ //! //! UNIX-specific structs and functions. Will be imported as `sys` on UNIX //! systems. +#![allow(unsafe_code)] use std::sync::atomic::{AtomicBool, Ordering::Relaxed}; @@ -40,6 +41,7 @@ static WSC: AtomicBool = AtomicBool::new(false); /// Handle a change in window size. extern "C" fn handle_wsize(_: c_int, _: *mut siginfo_t, _: *mut c_void) { WSC.store(true, Relaxed) } +#[allow(clippy::fn_to_numeric_cast_any)] /// Register a signal handler that sets a global variable when the window size /// changes. After calling this function, use `has_window_size_changed` to query /// the global variable. @@ -51,7 +53,7 @@ pub fn register_winsize_change_signal_handler() -> Result<(), Error> { // have sa_handler field, so we use sa_sigaction instead. (*maybe_sa.as_mut_ptr()).sa_flags = SA_SIGINFO; (*maybe_sa.as_mut_ptr()).sa_sigaction = handle_wsize as sighandler_t; - cerr(libc::sigaction(libc::SIGWINCH, maybe_sa.as_ptr(), std::ptr::null_mut())) + cerr(sigaction(libc::SIGWINCH, maybe_sa.as_ptr(), std::ptr::null_mut())) } } diff --git a/src/wasi.rs b/src/wasi.rs index cc04a5e4..545ea6e3 100644 --- a/src/wasi.rs +++ b/src/wasi.rs @@ -6,7 +6,7 @@ use crate::Error; pub use crate::xdg::*; -pub struct TermMode {} +pub struct TermMode; /// Return the current window size as (rows, columns). /// By returning an error we cause kibi to fall back to another method of diff --git a/src/windows.rs b/src/windows.rs index 9e0a8f24..749baafc 100644 --- a/src/windows.rs +++ b/src/windows.rs @@ -62,6 +62,6 @@ pub fn enable_raw_mode() -> Result { } #[allow(clippy::unnecessary_wraps)] // Result required on other platforms -pub fn stdin() -> std::io::Result { Ok(std::io::stdin()) } +pub fn stdin() -> io::Result { Ok(io::stdin()) } pub fn path(filename: &str) -> std::path::PathBuf { std::path::PathBuf::from(filename) } diff --git a/xtask/src/count_loc.rs b/xtask/src/count_loc.rs index d3a14a69..e96a2da0 100644 --- a/xtask/src/count_loc.rs +++ b/xtask/src/count_loc.rs @@ -1,4 +1,4 @@ -use std::path::PathBuf; +use std::path::{Path, PathBuf}; use anstream::println; use glob::glob; @@ -23,10 +23,10 @@ pub fn count_loc() -> Result<()> { print_summary(&results, longest_path, &["unix", "wasi", "windows"]) } -/// Filter out lines that contain `clippy` lints and anything after +/// Filter out lines that contain lints and anything after /// `#[cfg(test)]` attributes. -pub fn filter_lines(path: &std::path::PathBuf) -> Result { - let regex = Regex::new(r"^\s*#!?\[(?:allow|warn|deny)\(clippy::")?; +pub fn filter_lines(path: &Path) -> Result { + let regex = Regex::new(r"^\s*#!?\[(?:allow|warn|deny)\(")?; let content = std::fs::read_to_string(path)?; let lines = content .lines() @@ -60,7 +60,7 @@ pub fn print_summary(results: &[(PathBuf, usize)], width: usize, platforms: &[&s Ok(()) } -pub fn filter_count(results: &[(std::path::PathBuf, usize)], pattern: &str) -> usize { +pub fn filter_count(results: &[(PathBuf, usize)], pattern: &str) -> usize { results .iter() .filter(|(path, _)| path.display().to_string().contains(pattern)) diff --git a/xtask/src/main.rs b/xtask/src/main.rs index da95d597..0c3692cc 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -1,4 +1,5 @@ -use std::io::Write; +#![allow(clippy::multiple_crate_versions)] +use std::process::ExitCode; use anstyle::{AnsiColor, Reset, Style}; use clap::{Parser, Subcommand}; @@ -11,12 +12,14 @@ const RESET: Reset = Reset; const RED: Style = AnsiColor::Red.on_default(); const GREEN: Style = AnsiColor::Green.on_default(); -fn main() { +fn main() -> ExitCode { let args = Args::parse(); - if let Err(err) = args.command.execute() { - let _ = std::io::stdout().flush(); - eprintln!("{RED}{err}{RESET}"); - std::process::exit(1); + match args.command.execute() { + Ok(()) => ExitCode::SUCCESS, + Err(err) => { + eprintln!("{RED}{err}{RESET}"); + ExitCode::FAILURE + } } } @@ -34,7 +37,7 @@ enum Command { impl Command { fn execute(&self) -> Result<()> { match self { - Command::CountLoc => count_loc::count_loc(), + Self::CountLoc => count_loc::count_loc(), } } } From a03e7c2e100076d1647591434fbdeed1ae5a6871 Mon Sep 17 00:00:00 2001 From: Alexander Zaitsev Date: Wed, 27 Nov 2024 02:43:42 +0100 Subject: [PATCH 62/65] feat: enable LTO (#346) Signed-off-by: Alexander Zaitsev --- Cargo.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 48943b96..0b85c2a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -109,4 +109,7 @@ unused_result_ok = "deny" unwrap_used = "deny" use_debug = "deny" verbose_file_reads = "deny" -wildcard_enum_match_arm = "deny" \ No newline at end of file +wildcard_enum_match_arm = "deny" + +[profile.release] +lto = true From 9f0cf2c09f724f2aa3a29a227f38c430ae51133f Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 27 Nov 2024 01:31:14 -0500 Subject: [PATCH 63/65] add zamazan4ik as a contributor for infra (#347) --- .all-contributorsrc | 9 +++++++++ README.md | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index b032feb6..fada2b96 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -286,6 +286,15 @@ "infra", "code" ] + }, + { + "login": "zamazan4ik", + "name": "Alexander Zaitsev", + "avatar_url": "https://avatars.githubusercontent.com/u/7355383?v=4", + "profile": "https://zamazan4ik.github.io", + "contributions": [ + "infra" + ] } ], "commitType": "docs" diff --git a/README.md b/README.md index 81d282b1..33846b77 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md) [![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/ilai-deutel/kibi ) -[![All Contributors](https://img.shields.io/badge/all_contributors-30-orange.svg)](#contributors) +[![All Contributors](https://img.shields.io/badge/all_contributors-31-orange.svg)](#contributors) [![asciicast](assets/asciicast.gif)](https://asciinema.org/a/KY7tKPlxHXqRdJiv5KaTJbPj5) @@ -393,6 +393,7 @@ any kind welcome!
Jan9103

💻
Josh McKinney

🚇 💻 +
Alexander Zaitsev

🚇 From 1628b51db9967998dc22902b41d458f556b632f5 Mon Sep 17 00:00:00 2001 From: Adrian Banu <66678108+BanuAdrian@users.noreply.github.com> Date: Wed, 27 Nov 2024 16:59:15 +0200 Subject: [PATCH 64/65] Adding test for home + end keys (#311) * add test for pressing the home key --- src/editor.rs | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/src/editor.rs b/src/editor.rs index 94263214..794ef976 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -1106,4 +1106,70 @@ mod tests { assert_eq!(editor.cursor.x, 0); assert_eq!(editor.cursor.y, 3); } + + #[test] + fn editor_press_home_key() { + let mut editor = Editor::default(); + for b in b"Hello\nWorld\nand\nFerris!" { + if *b == b'\n' { + editor.insert_new_line(); + } else { + editor.insert_byte(*b); + } + } + + // check current position + assert_eq!(editor.cursor.x, 7); + assert_eq!(editor.cursor.y, 3); + + editor.process_keypress(&Key::Home); + assert_eq!(editor.cursor.x, 0); + assert_eq!(editor.cursor.y, 3); + + editor.move_cursor(&AKey::Up, false); + editor.move_cursor(&AKey::Up, false); + editor.move_cursor(&AKey::Up, false); + + assert_eq!(editor.cursor.x, 0); + assert_eq!(editor.cursor.y, 0); + + editor.move_cursor(&AKey::Right, true); + assert_eq!(editor.cursor.x, 5); + assert_eq!(editor.cursor.y, 0); + + editor.process_keypress(&Key::Home); + assert_eq!(editor.cursor.x, 0); + assert_eq!(editor.cursor.y, 0); + } + + #[test] + fn editor_press_end_key() { + let mut editor = Editor::default(); + for b in b"Hello\nWorld\nand\nFerris!" { + if *b == b'\n' { + editor.insert_new_line(); + } else { + editor.insert_byte(*b); + } + } + + // check current position + assert_eq!(editor.cursor.x, 7); + assert_eq!(editor.cursor.y, 3); + + editor.process_keypress(&Key::End); + assert_eq!(editor.cursor.x, 7); + assert_eq!(editor.cursor.y, 3); + + editor.move_cursor(&AKey::Up, false); + editor.move_cursor(&AKey::Up, false); + editor.move_cursor(&AKey::Up, false); + + assert_eq!(editor.cursor.x, 3); + assert_eq!(editor.cursor.y, 0); + + editor.process_keypress(&Key::End); + assert_eq!(editor.cursor.x, 5); + assert_eq!(editor.cursor.y, 0); + } } From fa5b32a366dd987941fdac45cfa6ec8e05d1ca6f Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 27 Nov 2024 09:59:40 -0500 Subject: [PATCH 65/65] add BanuAdrian as a contributor for test (#320) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * update README.md [skip ci] * update .all-contributorsrc [skip ci] --------- Signed-off-by: Ilaï Deutel Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> Co-authored-by: Ilaï Deutel --- .all-contributorsrc | 9 +++++++++ README.md | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index fada2b96..02a1d93f 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -295,6 +295,15 @@ "contributions": [ "infra" ] + }, + { + "login": "BanuAdrian", + "name": "Adrian Banu", + "avatar_url": "https://avatars.githubusercontent.com/u/66678108?v=4", + "profile": "https://github.com/BanuAdrian", + "contributions": [ + "test" + ] } ], "commitType": "docs" diff --git a/README.md b/README.md index 33846b77..4e2b2cd5 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md) [![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/ilai-deutel/kibi ) -[![All Contributors](https://img.shields.io/badge/all_contributors-31-orange.svg)](#contributors) +[![All Contributors](https://img.shields.io/badge/all_contributors-32-orange.svg)](#contributors) [![asciicast](assets/asciicast.gif)](https://asciinema.org/a/KY7tKPlxHXqRdJiv5KaTJbPj5) @@ -394,6 +394,7 @@ any kind welcome!
Jan9103

💻
Josh McKinney

🚇 💻
Alexander Zaitsev

🚇 +
Adrian Banu

⚠️