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

added partial solution #12

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-BADGE:START - Do not remove or modify this section -->
[![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)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

[![asciicast](assets/asciicast.gif)](https://asciinema.org/a/KY7tKPlxHXqRdJiv5KaTJbPj5)
Expand Down Expand Up @@ -378,6 +378,7 @@ any kind welcome!
<td align="center" valign="top" width="14.28%"><a href="https://github.com/CosminGGeorgescu"><img src="https://avatars.githubusercontent.com/u/95082750?v=4" width="100px;" alt=""/><br /><sub><b>CosminGGeorgescu</b></sub></a><br /><a href="https://github.com/ilai-deutel/kibi/commits?author=CosminGGeorgescu" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/TanvirOnGH"><img src="https://avatars.githubusercontent.com/u/138336161?v=4" width="100px;" alt=""/><br /><sub><b>Tanvir</b></sub></a><br /><a href="#syntax-highlighting-TanvirOnGH" title="Contributing to syntax highlighting configuration files">💠</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/BogdanPaul15"><img src="https://avatars.githubusercontent.com/u/62438221?v=4" width="100px;" alt=""/><br /><sub><b>Prisacaru Bogdan-Paul</b></sub></a><br /><a href="https://github.com/ilai-deutel/kibi/commits?author=BogdanPaul15" title="Tests">⚠️</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/auzkok"><img src="https://avatars.githubusercontent.com/u/35302680?v=4" width="100px;" alt=""/><br /><sub><b>auzkok</b></sub></a><br /><a href="#syntax-highlighting-auzkok" title="Contributing to syntax highlighting configuration files">💠</a></td>
</tr>
</tbody>
</table>
Expand Down
25 changes: 16 additions & 9 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 @@ -28,9 +30,10 @@

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

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__

/// Enum of input keys
enum Key {
Expand Down Expand Up @@ -593,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)
};
// Finally, print `buffer` and move the cursor
print!("{buffer}\x1b[{cursor_y};{cursor_x}H{SHOW_CURSOR}");
Expand Down Expand Up @@ -678,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));
return Some(current);
}
}
Expand Down Expand Up @@ -837,18 +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(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)),
// 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__

PromptState::Active(buffer)
}

Expand Down
Loading