Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utf8 prompts #281

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
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 unicode_width::UnicodeWidthStr;

use crate::row::{HlState, Row};
use crate::{ansi_escape::*, syntax::Conf as SyntaxConf, sys, terminal, Config, Error};
Expand All @@ -30,6 +32,9 @@
/// 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),*)))) }

// `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 }

Check failure on line 36 in src/editor.rs

View workflow job for this annotation

GitHub Actions / static_checks (ubuntu-latest, x86_64-unknown-linux-gnu)

[clippy-x86_64-unknown-linux-gnu] reported by reviewdog 🐶 <pre><code>error: writing `&String` instead of `&str` involves a new object where a slice will do --> src/editor.rs:36:19 | 36 | fn dsp_width(msg: &String) -> usize { UnicodeWidthStr::width(msg.as_str()) + 1 } | ^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg = note: `-D clippy::ptr-arg` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::ptr_arg)]` help: change this to | 36 | fn dsp_width(msg: &str) -> usize { UnicodeWidthStr::width(msg) + 1 } | ~~~~ ~~~ </code></pre> Raw Output: src/editor.rs:36:19:e: <pre><code>error: writing `&String` instead of `&str` involves a new object where a slice will do --> src/editor.rs:36:19 | 36 | fn dsp_width(msg: &String) -> usize { UnicodeWidthStr::width(msg.as_str()) + 1 } | ^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg = note: `-D clippy::ptr-arg` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::ptr_arg)]` help: change this to | 36 | fn dsp_width(msg: &str) -> usize { UnicodeWidthStr::width(msg) + 1 } | ~~~~ ~~~ </code></pre> __END__

Check failure on line 36 in src/editor.rs

View workflow job for this annotation

GitHub Actions / static_checks (macos-latest, x86_64-apple-darwin)

[clippy-x86_64-apple-darwin] reported by reviewdog 🐶 <pre><code>error: writing `&String` instead of `&str` involves a new object where a slice will do --> src/editor.rs:36:19 | 36 | fn dsp_width(msg: &String) -> usize { UnicodeWidthStr::width(msg.as_str()) + 1 } | ^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg = note: `-D clippy::ptr-arg` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::ptr_arg)]` help: change this to | 36 | fn dsp_width(msg: &str) -> usize { UnicodeWidthStr::width(msg) + 1 } | ~~~~ ~~~ </code></pre> Raw Output: src/editor.rs:36:19:e: <pre><code>error: writing `&String` instead of `&str` involves a new object where a slice will do --> src/editor.rs:36:19 | 36 | fn dsp_width(msg: &String) -> usize { UnicodeWidthStr::width(msg.as_str()) + 1 } | ^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg = note: `-D clippy::ptr-arg` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::ptr_arg)]` help: change this to | 36 | fn dsp_width(msg: &str) -> usize { UnicodeWidthStr::width(msg) + 1 } | ~~~~ ~~~ </code></pre> __END__

Check failure on line 36 in src/editor.rs

View workflow job for this annotation

GitHub Actions / static_checks (ubuntu-latest, wasm32-wasi)

[clippy-wasm32-wasi] reported by reviewdog 🐶 <pre><code>error: writing `&String` instead of `&str` involves a new object where a slice will do --> src/editor.rs:36:19 | 36 | fn dsp_width(msg: &String) -> usize { UnicodeWidthStr::width(msg.as_str()) + 1 } | ^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg = note: `-D clippy::ptr-arg` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::ptr_arg)]` help: change this to | 36 | fn dsp_width(msg: &str) -> usize { UnicodeWidthStr::width(msg) + 1 } | ~~~~ ~~~ </code></pre> Raw Output: src/editor.rs:36:19:e: <pre><code>error: writing `&String` instead of `&str` involves a new object where a slice will do --> src/editor.rs:36:19 | 36 | fn dsp_width(msg: &String) -> usize { UnicodeWidthStr::width(msg.as_str()) + 1 } | ^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg = note: `-D clippy::ptr-arg` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::ptr_arg)]` help: change this to | 36 | fn dsp_width(msg: &str) -> usize { UnicodeWidthStr::width(msg) + 1 } | ~~~~ ~~~ </code></pre> __END__

Check warning on line 36 in src/editor.rs

View check run for this annotation

Codecov / codecov/patch

src/editor.rs#L36

Added line #L36 was not covered by tests

/// Enum of input keys
enum Key {
Arrow(AKey),
Expand Down Expand Up @@ -591,7 +596,7 @@
(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| dsp_width(&s.msg)), self.screen_rows + 2)

Check warning on line 599 in src/editor.rs

View check run for this annotation

Codecov / codecov/patch

src/editor.rs#L599

Added line #L599 was not covered by tests
};
// Finally, print `buffer` and move the cursor
print!("{buffer}\x1b[{cursor_y};{cursor_x}H{SHOW_CURSOR}");
Expand Down Expand Up @@ -676,7 +681,7 @@
// 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 + UnicodeWidthStr::width(query));

Check warning on line 684 in src/editor.rs

View check run for this annotation

Codecov / codecov/patch

src/editor.rs#L684

Added line #L684 was not covered by tests
return Some(current);
}
}
Expand Down Expand Up @@ -835,16 +840,22 @@
Cancelled,
}

thread_local! (static CHARACTER: RefCell<Vec<u8>> = {let cache = Vec::new(); RefCell::new(cache)});

Check failure on line 843 in src/editor.rs

View workflow job for this annotation

GitHub Actions / static_checks (ubuntu-latest, x86_64-unknown-linux-gnu)

[clippy-x86_64-unknown-linux-gnu] reported by reviewdog 🐶 <pre><code>error: initializer for `thread_local` value can be made `const` --> src/editor.rs:843:53 | 843 | thread_local! (static CHARACTER: RefCell<Vec<u8>> = {let cache = Vec::new(); RefCell::new(cache)}); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `const { {let cache = Vec::new(); RefCell::new(cache)} }` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#thread_local_initializer_can_be_made_const = note: `-D clippy::thread-local-initializer-can-be-made-const` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::thread_local_initializer_can_be_made_const)]` </code></pre> Raw Output: src/editor.rs:843:53:e: <pre><code>error: initializer for `thread_local` value can be made `const` --> src/editor.rs:843:53 | 843 | thread_local! (static CHARACTER: RefCell<Vec<u8>> = {let cache = Vec::new(); RefCell::new(cache)}); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `const { {let cache = Vec::new(); RefCell::new(cache)} }` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#thread_local_initializer_can_be_made_const = note: `-D clippy::thread-local-initializer-can-be-made-const` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::thread_local_initializer_can_be_made_const)]` </code></pre> __END__

Check failure on line 843 in src/editor.rs

View workflow job for this annotation

GitHub Actions / static_checks (macos-latest, x86_64-apple-darwin)

[clippy-x86_64-apple-darwin] reported by reviewdog 🐶 <pre><code>error: initializer for `thread_local` value can be made `const` --> src/editor.rs:843:53 | 843 | thread_local! (static CHARACTER: RefCell<Vec<u8>> = {let cache = Vec::new(); RefCell::new(cache)}); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `const { {let cache = Vec::new(); RefCell::new(cache)} }` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#thread_local_initializer_can_be_made_const = note: `-D clippy::thread-local-initializer-can-be-made-const` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::thread_local_initializer_can_be_made_const)]` </code></pre> Raw Output: src/editor.rs:843:53:e: <pre><code>error: initializer for `thread_local` value can be made `const` --> src/editor.rs:843:53 | 843 | thread_local! (static CHARACTER: RefCell<Vec<u8>> = {let cache = Vec::new(); RefCell::new(cache)}); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `const { {let cache = Vec::new(); RefCell::new(cache)} }` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#thread_local_initializer_can_be_made_const = note: `-D clippy::thread-local-initializer-can-be-made-const` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::thread_local_initializer_can_be_made_const)]` </code></pre> __END__

Check failure on line 843 in src/editor.rs

View workflow job for this annotation

GitHub Actions / static_checks (ubuntu-latest, wasm32-wasi)

[clippy-wasm32-wasi] reported by reviewdog 🐶 <pre><code>error: initializer for `thread_local` value can be made `const` --> src/editor.rs:843:53 | 843 | thread_local! (static CHARACTER: RefCell<Vec<u8>> = {let cache = Vec::new(); RefCell::new(cache)}); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `const { {let cache = Vec::new(); RefCell::new(cache)} }` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#thread_local_initializer_can_be_made_const = note: `-D clippy::thread-local-initializer-can-be-made-const` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::thread_local_initializer_can_be_made_const)]` </code></pre> Raw Output: src/editor.rs:843:53:e: <pre><code>error: initializer for `thread_local` value can be made `const` --> src/editor.rs:843:53 | 843 | thread_local! (static CHARACTER: RefCell<Vec<u8>> = {let cache = Vec::new(); RefCell::new(cache)}); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `const { {let cache = Vec::new(); RefCell::new(cache)} }` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#thread_local_initializer_can_be_made_const = note: `-D clippy::thread-local-initializer-can-be-made-const` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::thread_local_initializer_can_be_made_const)]` </code></pre> __END__
/// 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(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)),

Check warning on line 851 in src/editor.rs

View check run for this annotation

Codecov / codecov/patch

src/editor.rs#L851

Added line #L851 was not covered by tests
// No-op
_ => (),
}
let character = CHARACTER.with(|cache| String::from_utf8(cache.borrow_mut().clone()));
let _ = character.clone().map_or((), |c| buffer.push_str(c.as_str()));

Check failure on line 856 in src/editor.rs

View workflow job for this annotation

GitHub Actions / static_checks (ubuntu-latest, x86_64-unknown-linux-gnu)

[clippy-x86_64-unknown-linux-gnu] reported by reviewdog 🐶 <pre><code>error: this let-binding has unit value --> src/editor.rs:856:5 | 856 | let _ = character.clone().map_or((), |c| buffer.push_str(c.as_str())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `character.clone().map_or((), |c| buffer.push_str(c.as_str()));` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value = note: `-D clippy::let-unit-value` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::let_unit_value)]` </code></pre> Raw Output: src/editor.rs:856:5:e: <pre><code>error: this let-binding has unit value --> src/editor.rs:856:5 | 856 | let _ = character.clone().map_or((), |c| buffer.push_str(c.as_str())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `character.clone().map_or((), |c| buffer.push_str(c.as_str()));` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value = note: `-D clippy::let-unit-value` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::let_unit_value)]` </code></pre> __END__

Check failure on line 856 in src/editor.rs

View workflow job for this annotation

GitHub Actions / static_checks (ubuntu-latest, x86_64-unknown-linux-gnu)

[clippy-x86_64-unknown-linux-gnu] reported by reviewdog 🐶 <pre><code>error: matching over `()` is more explicit --> src/editor.rs:856:9 | 856 | let _ = character.clone().map_or((), |c| buffer.push_str(c.as_str())); | ^ help: use `()` instead of `_`: `()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns = note: `-D clippy::ignored-unit-patterns` implied by `-D clippy::pedantic` = help: to override `-D clippy::pedantic` add `#[allow(clippy::ignored_unit_patterns)]` </code></pre> Raw Output: src/editor.rs:856:9:e: <pre><code>error: matching over `()` is more explicit --> src/editor.rs:856:9 | 856 | let _ = character.clone().map_or((), |c| buffer.push_str(c.as_str())); | ^ help: use `()` instead of `_`: `()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns = note: `-D clippy::ignored-unit-patterns` implied by `-D clippy::pedantic` = help: to override `-D clippy::pedantic` add `#[allow(clippy::ignored_unit_patterns)]` </code></pre> __END__

Check failure on line 856 in src/editor.rs

View workflow job for this annotation

GitHub Actions / static_checks (macos-latest, x86_64-apple-darwin)

[clippy-x86_64-apple-darwin] reported by reviewdog 🐶 <pre><code>error: this let-binding has unit value --> src/editor.rs:856:5 | 856 | let _ = character.clone().map_or((), |c| buffer.push_str(c.as_str())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `character.clone().map_or((), |c| buffer.push_str(c.as_str()));` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value = note: `-D clippy::let-unit-value` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::let_unit_value)]` </code></pre> Raw Output: src/editor.rs:856:5:e: <pre><code>error: this let-binding has unit value --> src/editor.rs:856:5 | 856 | let _ = character.clone().map_or((), |c| buffer.push_str(c.as_str())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `character.clone().map_or((), |c| buffer.push_str(c.as_str()));` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value = note: `-D clippy::let-unit-value` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::let_unit_value)]` </code></pre> __END__

Check failure on line 856 in src/editor.rs

View workflow job for this annotation

GitHub Actions / static_checks (macos-latest, x86_64-apple-darwin)

[clippy-x86_64-apple-darwin] reported by reviewdog 🐶 <pre><code>error: matching over `()` is more explicit --> src/editor.rs:856:9 | 856 | let _ = character.clone().map_or((), |c| buffer.push_str(c.as_str())); | ^ help: use `()` instead of `_`: `()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns = note: `-D clippy::ignored-unit-patterns` implied by `-D clippy::pedantic` = help: to override `-D clippy::pedantic` add `#[allow(clippy::ignored_unit_patterns)]` </code></pre> Raw Output: src/editor.rs:856:9:e: <pre><code>error: matching over `()` is more explicit --> src/editor.rs:856:9 | 856 | let _ = character.clone().map_or((), |c| buffer.push_str(c.as_str())); | ^ help: use `()` instead of `_`: `()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns = note: `-D clippy::ignored-unit-patterns` implied by `-D clippy::pedantic` = help: to override `-D clippy::pedantic` add `#[allow(clippy::ignored_unit_patterns)]` </code></pre> __END__

Check failure on line 856 in src/editor.rs

View workflow job for this annotation

GitHub Actions / static_checks (ubuntu-latest, wasm32-wasi)

[clippy-wasm32-wasi] reported by reviewdog 🐶 <pre><code>error: this let-binding has unit value --> src/editor.rs:856:5 | 856 | let _ = character.clone().map_or((), |c| buffer.push_str(c.as_str())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `character.clone().map_or((), |c| buffer.push_str(c.as_str()));` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value = note: `-D clippy::let-unit-value` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::let_unit_value)]` </code></pre> Raw Output: src/editor.rs:856:5:e: <pre><code>error: this let-binding has unit value --> src/editor.rs:856:5 | 856 | let _ = character.clone().map_or((), |c| buffer.push_str(c.as_str())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `character.clone().map_or((), |c| buffer.push_str(c.as_str()));` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value = note: `-D clippy::let-unit-value` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::let_unit_value)]` </code></pre> __END__

Check failure on line 856 in src/editor.rs

View workflow job for this annotation

GitHub Actions / static_checks (ubuntu-latest, wasm32-wasi)

[clippy-wasm32-wasi] reported by reviewdog 🐶 <pre><code>error: matching over `()` is more explicit --> src/editor.rs:856:9 | 856 | let _ = character.clone().map_or((), |c| buffer.push_str(c.as_str())); | ^ help: use `()` instead of `_`: `()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns = note: `-D clippy::ignored-unit-patterns` implied by `-D clippy::pedantic` = help: to override `-D clippy::pedantic` add `#[allow(clippy::ignored_unit_patterns)]` </code></pre> Raw Output: src/editor.rs:856:9:e: <pre><code>error: matching over `()` is more explicit --> src/editor.rs:856:9 | 856 | let _ = character.clone().map_or((), |c| buffer.push_str(c.as_str())); | ^ help: use `()` instead of `_`: `()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns = note: `-D clippy::ignored-unit-patterns` implied by `-D clippy::pedantic` = help: to override `-D clippy::pedantic` add `#[allow(clippy::ignored_unit_patterns)]` </code></pre> __END__
let _ = character.map_or((), |_| CHARACTER.with(|cache| cache.borrow_mut().clear()));

Check failure on line 857 in src/editor.rs

View workflow job for this annotation

GitHub Actions / static_checks (ubuntu-latest, x86_64-unknown-linux-gnu)

[clippy-x86_64-unknown-linux-gnu] reported by reviewdog 🐶 <pre><code>error: this let-binding has unit value --> src/editor.rs:857:5 | 857 | let _ = character.map_or((), |_| CHARACTER.with(|cache| cache.borrow_mut().clear())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `character.map_or((), |_| CHARACTER.with(|cache| cache.borrow_mut().clear()));` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value </code></pre> Raw Output: src/editor.rs:857:5:e: <pre><code>error: this let-binding has unit value --> src/editor.rs:857:5 | 857 | let _ = character.map_or((), |_| CHARACTER.with(|cache| cache.borrow_mut().clear())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `character.map_or((), |_| CHARACTER.with(|cache| cache.borrow_mut().clear()));` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value </code></pre> __END__

Check failure on line 857 in src/editor.rs

View workflow job for this annotation

GitHub Actions / static_checks (ubuntu-latest, x86_64-unknown-linux-gnu)

[clippy-x86_64-unknown-linux-gnu] reported by reviewdog 🐶 <pre><code>error: matching over `()` is more explicit --> src/editor.rs:857:9 | 857 | let _ = character.map_or((), |_| CHARACTER.with(|cache| cache.borrow_mut().clear())); | ^ help: use `()` instead of `_`: `()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns </code></pre> Raw Output: src/editor.rs:857:9:e: <pre><code>error: matching over `()` is more explicit --> src/editor.rs:857:9 | 857 | let _ = character.map_or((), |_| CHARACTER.with(|cache| cache.borrow_mut().clear())); | ^ help: use `()` instead of `_`: `()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns </code></pre> __END__

Check failure on line 857 in src/editor.rs

View workflow job for this annotation

GitHub Actions / static_checks (macos-latest, x86_64-apple-darwin)

[clippy-x86_64-apple-darwin] reported by reviewdog 🐶 <pre><code>error: this let-binding has unit value --> src/editor.rs:857:5 | 857 | let _ = character.map_or((), |_| CHARACTER.with(|cache| cache.borrow_mut().clear())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `character.map_or((), |_| CHARACTER.with(|cache| cache.borrow_mut().clear()));` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value </code></pre> Raw Output: src/editor.rs:857:5:e: <pre><code>error: this let-binding has unit value --> src/editor.rs:857:5 | 857 | let _ = character.map_or((), |_| CHARACTER.with(|cache| cache.borrow_mut().clear())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `character.map_or((), |_| CHARACTER.with(|cache| cache.borrow_mut().clear()));` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value </code></pre> __END__

Check failure on line 857 in src/editor.rs

View workflow job for this annotation

GitHub Actions / static_checks (macos-latest, x86_64-apple-darwin)

[clippy-x86_64-apple-darwin] reported by reviewdog 🐶 <pre><code>error: matching over `()` is more explicit --> src/editor.rs:857:9 | 857 | let _ = character.map_or((), |_| CHARACTER.with(|cache| cache.borrow_mut().clear())); | ^ help: use `()` instead of `_`: `()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns </code></pre> Raw Output: src/editor.rs:857:9:e: <pre><code>error: matching over `()` is more explicit --> src/editor.rs:857:9 | 857 | let _ = character.map_or((), |_| CHARACTER.with(|cache| cache.borrow_mut().clear())); | ^ help: use `()` instead of `_`: `()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns </code></pre> __END__

Check failure on line 857 in src/editor.rs

View workflow job for this annotation

GitHub Actions / static_checks (ubuntu-latest, wasm32-wasi)

[clippy-wasm32-wasi] reported by reviewdog 🐶 <pre><code>error: this let-binding has unit value --> src/editor.rs:857:5 | 857 | let _ = character.map_or((), |_| CHARACTER.with(|cache| cache.borrow_mut().clear())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `character.map_or((), |_| CHARACTER.with(|cache| cache.borrow_mut().clear()));` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value </code></pre> Raw Output: src/editor.rs:857:5:e: <pre><code>error: this let-binding has unit value --> src/editor.rs:857:5 | 857 | let _ = character.map_or((), |_| CHARACTER.with(|cache| cache.borrow_mut().clear())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `character.map_or((), |_| CHARACTER.with(|cache| cache.borrow_mut().clear()));` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value </code></pre> __END__

Check failure on line 857 in src/editor.rs

View workflow job for this annotation

GitHub Actions / static_checks (ubuntu-latest, wasm32-wasi)

[clippy-wasm32-wasi] reported by reviewdog 🐶 <pre><code>error: matching over `()` is more explicit --> src/editor.rs:857:9 | 857 | let _ = character.map_or((), |_| CHARACTER.with(|cache| cache.borrow_mut().clear())); | ^ help: use `()` instead of `_`: `()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns </code></pre> Raw Output: src/editor.rs:857:9:e: <pre><code>error: matching over `()` is more explicit --> src/editor.rs:857:9 | 857 | let _ = character.map_or((), |_| CHARACTER.with(|cache| cache.borrow_mut().clear())); | ^ help: use `()` instead of `_`: `()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns </code></pre> __END__

Check warning on line 857 in src/editor.rs

View check run for this annotation

Codecov / codecov/patch

src/editor.rs#L855-L857

Added lines #L855 - L857 were not covered by tests

PromptState::Active(buffer)
}

Expand Down
Loading