diff options
author | Cole Helbling | 2023-11-25 12:55:49 +0000 |
---|---|---|
committer | GitHub | 2023-11-25 12:55:49 +0000 |
commit | 8b0ae3d27912799d59e4948ff11d3a5428e32ce4 (patch) | |
tree | 579190b16189202c1dbb9ef86c607e9c75616c8d /helix-term/src | |
parent | 090ed97e0045bfad1e5bff8b96c61707b996b85a (diff) |
bump MSRV to 1.70.0 (#8877)
* rust-toolchain.toml: bump MSRV to 1.70.0
With Firefox 120 released on 21 November 2023, the MSRV is now 1.70.0.
* Fix cargo fmt with Rust 1.70.0
* Fix cargo clippy with Rust 1.70.0
* Fix cargo doc with Rust 1.70.0
* rust-toolchain.toml: add clippy component
* .github: bump dtolnay/rust-toolchain to 1.70
* helix-term: bump rust-version to 1.70
* helix-view/gutter: use checked_ilog10 to count digits
* helix-core/syntax: use MAIN_SEPARATOR_STR constant
* helix-view/handlers/dap: use Display impl for displaying process spawn error
* WIP: helix-term/commands: use checked math to assert ranges cannot overlap
Diffstat (limited to 'helix-term/src')
-rw-r--r-- | helix-term/src/commands.rs | 16 | ||||
-rw-r--r-- | helix-term/src/commands/lsp.rs | 2 |
2 files changed, 12 insertions, 6 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index bc54abaa..cd053266 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1318,7 +1318,7 @@ fn extend_next_long_word_end(cx: &mut Context) { extend_word_impl(cx, movement::move_next_long_word_end) } -/// Separate branch to find_char designed only for <ret> char. +/// Separate branch to find_char designed only for `<ret>` char. // // This is necessary because the one document can have different line endings inside. And we // cannot predict what character to find when <ret> is pressed. On the current line it can be `lf` @@ -5606,12 +5606,18 @@ fn shell(cx: &mut compositor::Context, cmd: &str, behavior: &ShellBehavior) { }; // These `usize`s cannot underflow because selection ranges cannot overlap. - // Once the MSRV is 1.66.0 (mixed_integer_ops is stabilized), we can use checked - // arithmetic to assert this. - let anchor = (to as isize + offset - deleted_len as isize) as usize; + let anchor = to + .checked_add_signed(offset) + .expect("Selection ranges cannot overlap") + .checked_sub(deleted_len) + .expect("Selection ranges cannot overlap"); let new_range = Range::new(anchor, anchor + output_len).with_direction(range.direction()); ranges.push(new_range); - offset = offset + output_len as isize - deleted_len as isize; + offset = offset + .checked_add_unsigned(output_len) + .expect("Selection ranges cannot overlap") + .checked_sub_unsigned(deleted_len) + .expect("Selection ranges cannot overlap"); changes.push((from, to, Some(output))); } diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs index 57be1267..87400461 100644 --- a/helix-term/src/commands/lsp.rs +++ b/helix-term/src/commands/lsp.rs @@ -49,7 +49,7 @@ use std::{ /// If there is no configured language server that supports the feature, this displays a status message. /// Using this macro in a context where the editor automatically queries the LSP /// (instead of when the user explicitly does so via a keybind like `gd`) -/// will spam the "No configured language server supports <feature>" status message confusingly. +/// will spam the "No configured language server supports \<feature>" status message confusingly. #[macro_export] macro_rules! language_server_with_feature { ($editor:expr, $doc:expr, $feature:expr) => {{ |