on master help sign in
bump MSRV to 1.70.0 (#8877)
8b0ae3dCole Helbling
.github/workflows/build.yml+3−3
@@ -39,7 +39,7 @@ jobs:
39 uses: actions/checkout@v4
39 uses: actions/checkout@v4
40
40
41 - name: Install stable toolchain
41 - name: Install stable toolchain
42− uses: dtolnay/rust-toolchain@1.65
42+ uses: dtolnay/rust-toolchain@1.70
43
43
44 - uses: Swatinem/rust-cache@v2
44 - uses: Swatinem/rust-cache@v2
45 with:
45 with:
@@ -70,7 +70,7 @@ jobs:
70 uses: actions/checkout@v4
70 uses: actions/checkout@v4
71
71
72 - name: Install stable toolchain
72 - name: Install stable toolchain
73− uses: dtolnay/rust-toolchain@1.65
73+ uses: dtolnay/rust-toolchain@1.70
74 with:
74 with:
75 components: rustfmt, clippy
75 components: rustfmt, clippy
76
76
@@ -97,7 +97,7 @@ jobs:
97 uses: actions/checkout@v4
97 uses: actions/checkout@v4
98
98
99 - name: Install stable toolchain
99 - name: Install stable toolchain
100− uses: dtolnay/rust-toolchain@1.65
100+ uses: dtolnay/rust-toolchain@1.70
101
101
102 - uses: Swatinem/rust-cache@v2
102 - uses: Swatinem/rust-cache@v2
103 with:
103 with:
helix-core/src/syntax.rs+1−4
@@ -212,10 +212,7 @@ impl<'de> Deserialize<'de> for FileType {
212 {
212 {
213 match map.next_entry::<String, String>()? {
213 match map.next_entry::<String, String>()? {
214 Some((key, suffix)) if key == "suffix" => Ok(FileType::Suffix({
214 Some((key, suffix)) if key == "suffix" => Ok(FileType::Suffix({
215− // FIXME: use `suffix.replace('/', std::path::MAIN_SEPARATOR_STR)`
215+ suffix.replace('/', std::path::MAIN_SEPARATOR_STR)
216− // if MSRV is updated to 1.68
217− let mut separator = [0; 1];
218− suffix.replace('/', std::path::MAIN_SEPARATOR.encode_utf8(&mut separator))
219 })),
216 })),
220 Some((key, _value)) => Err(serde::de::Error::custom(format!(
217 Some((key, _value)) => Err(serde::de::Error::custom(format!(
221 "unknown key in `file-types` list: {}",
218 "unknown key in `file-types` list: {}",
helix-term/Cargo.toml+1−1
@@ -10,7 +10,7 @@ repository = "https://github.com/helix-editor/helix"
10homepage = "https://helix-editor.com"
10homepage = "https://helix-editor.com"
11include = ["src/**/*", "README.md"]
11include = ["src/**/*", "README.md"]
12default-run = "hx"
12default-run = "hx"
13−rust-version = "1.65"
13+rust-version = "1.70"
14
14
15[features]
15[features]
16default = ["git"]
16default = ["git"]
helix-term/src/commands.rs+11−5
@@ -1318,7 +1318,7 @@ fn extend_next_long_word_end(cx: &mut Context) {
1318 extend_word_impl(cx, movement::move_next_long_word_end)
1318 extend_word_impl(cx, movement::move_next_long_word_end)
1319}
1319}
1320
1320
1321−/// Separate branch to find_char designed only for <ret> char.
1321+/// Separate branch to find_char designed only for `<ret>` char.
1322//
1322//
1323// This is necessary because the one document can have different line endings inside. And we
1323// This is necessary because the one document can have different line endings inside. And we
1324// cannot predict what character to find when <ret> is pressed. On the current line it can be `lf`
1324// 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) {
5606 };
5606 };
5607
5607
5608 // These `usize`s cannot underflow because selection ranges cannot overlap.
5608 // These `usize`s cannot underflow because selection ranges cannot overlap.
5609− // Once the MSRV is 1.66.0 (mixed_integer_ops is stabilized), we can use checked
5609+ let anchor = to
5610− // arithmetic to assert this.
5610+ .checked_add_signed(offset)
5611− let anchor = (to as isize + offset - deleted_len as isize) as usize;
5611+ .expect("Selection ranges cannot overlap")
5612+ .checked_sub(deleted_len)
5613+ .expect("Selection ranges cannot overlap");
5612 let new_range = Range::new(anchor, anchor + output_len).with_direction(range.direction());
5614 let new_range = Range::new(anchor, anchor + output_len).with_direction(range.direction());
5613 ranges.push(new_range);
5615 ranges.push(new_range);
5614− offset = offset + output_len as isize - deleted_len as isize;
5616+ offset = offset
5617+ .checked_add_unsigned(output_len)
5618+ .expect("Selection ranges cannot overlap")
5619+ .checked_sub_unsigned(deleted_len)
5620+ .expect("Selection ranges cannot overlap");
5615
5621
5616 changes.push((from, to, Some(output)));
5622 changes.push((from, to, Some(output)));
5617 }
5623 }
helix-term/src/commands/lsp.rs+1−1
@@ -49,7 +49,7 @@ use std::{
49/// If there is no configured language server that supports the feature, this displays a status message.
49/// If there is no configured language server that supports the feature, this displays a status message.
50/// Using this macro in a context where the editor automatically queries the LSP
50/// Using this macro in a context where the editor automatically queries the LSP
51/// (instead of when the user explicitly does so via a keybind like `gd`)
51/// (instead of when the user explicitly does so via a keybind like `gd`)
52−/// will spam the "No configured language server supports <feature>" status message confusingly.
52+/// will spam the "No configured language server supports \<feature>" status message confusingly.
53#[macro_export]
53#[macro_export]
54macro_rules! language_server_with_feature {
54macro_rules! language_server_with_feature {
55 ($editor:expr, $doc:expr, $feature:expr) => {{
55 ($editor:expr, $doc:expr, $feature:expr) => {{
helix-tui/src/buffer.rs+2−2
@@ -213,7 +213,7 @@ impl Buffer {
213 && y < self.area.bottom()
213 && y < self.area.bottom()
214 }
214 }
215
215
216− /// Returns the index in the Vec<Cell> for the given global (x, y) coordinates.
216+ /// Returns the index in the `Vec<Cell>` for the given global (x, y) coordinates.
217 ///
217 ///
218 /// Global coordinates are offset by the Buffer's area offset (`x`/`y`).
218 /// Global coordinates are offset by the Buffer's area offset (`x`/`y`).
219 ///
219 ///
@@ -242,7 +242,7 @@ impl Buffer {
242 ((y - self.area.y) as usize) * (self.area.width as usize) + ((x - self.area.x) as usize)
242 ((y - self.area.y) as usize) * (self.area.width as usize) + ((x - self.area.x) as usize)
243 }
243 }
244
244
245− /// Returns the index in the Vec<Cell> for the given global (x, y) coordinates,
245+ /// Returns the index in the `Vec<Cell>` for the given global (x, y) coordinates,
246 /// or `None` if the coordinates are outside the buffer's area.
246 /// or `None` if the coordinates are outside the buffer's area.
247 fn index_of_opt(&self, x: u16, y: u16) -> Option<usize> {
247 fn index_of_opt(&self, x: u16, y: u16) -> Option<usize> {
248 if self.in_bounds(x, y) {
248 if self.in_bounds(x, y) {
helix-view/src/editor.rs+3−8
@@ -727,7 +727,7 @@ pub struct WhitespaceCharacters {
727impl Default for WhitespaceCharacters {
727impl Default for WhitespaceCharacters {
728 fn default() -> Self {
728 fn default() -> Self {
729 Self {
729 Self {
730− space: '·', // U+00B7
730+ space: '·', // U+00B7
731 nbsp: '⍽', // U+237D
731 nbsp: '⍽', // U+237D
732 tab: '→', // U+2192
732 tab: '→', // U+2192
733 newline: '⏎', // U+23CE
733 newline: '⏎', // U+23CE
@@ -755,12 +755,13 @@ impl Default for IndentGuidesConfig {
755}
755}
756
756
757/// Line ending configuration.
757/// Line ending configuration.
758−#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
758+#[derive(Default, Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
759#[serde(rename_all = "lowercase")]
759#[serde(rename_all = "lowercase")]
760pub enum LineEndingConfig {
760pub enum LineEndingConfig {
761 /// The platform's native line ending.
761 /// The platform's native line ending.
762 ///
762 ///
763 /// `crlf` on Windows, otherwise `lf`.
763 /// `crlf` on Windows, otherwise `lf`.
764+ #[default]
764 Native,
765 Native,
765 /// Line feed.
766 /// Line feed.
766 LF,
767 LF,
@@ -777,12 +778,6 @@ pub enum LineEndingConfig {
777 Nel,
778 Nel,
778}
779}
779
780
780−impl Default for LineEndingConfig {
781− fn default() -> Self {
782− LineEndingConfig::Native
783− }
784−}
785−
786impl From<LineEndingConfig> for LineEnding {
781impl From<LineEndingConfig> for LineEnding {
787 fn from(line_ending: LineEndingConfig) -> Self {
782 fn from(line_ending: LineEndingConfig) -> Self {
788 match line_ending {
783 match line_ending {
helix-view/src/gutter.rs+1−2
@@ -9,8 +9,7 @@ use crate::{
9};
9};
10
10
11fn count_digits(n: usize) -> usize {
11fn count_digits(n: usize) -> usize {
12− // TODO: use checked_log10 when MSRV reaches 1.67
12+ (usize::checked_ilog10(n).unwrap_or(0) + 1) as usize
13− std::iter::successors(Some(n), |&n| (n >= 10).then_some(n / 10)).count()
14}
13}
15
14
16pub type GutterFn<'doc> = Box<dyn FnMut(usize, bool, bool, &mut String) -> Option<Style> + 'doc>;
15pub type GutterFn<'doc> = Box<dyn FnMut(usize, bool, bool, &mut String) -> Option<Style> + 'doc>;
helix-view/src/handlers/dap.rs+1−3
@@ -369,9 +369,7 @@ impl Editor {
369 {
369 {
370 Ok(process) => process,
370 Ok(process) => process,
371 Err(err) => {
371 Err(err) => {
372− // TODO replace the pretty print {:?} with a regular format {}
373− // when the MSRV is raised to 1.60.0
374− self.set_error(format!("Error starting external terminal: {:?}", err));
372+ self.set_error(format!("Error starting external terminal: {}", err));
375 return true;
373 return true;
376 }
374 }
377 };
375 };
rust-toolchain.toml+2−2
@@ -1,3 +1,3 @@
1[toolchain]
1[toolchain]
2−channel = "1.65.0"
2+channel = "1.70.0"
3−components = ["rustfmt", "rust-src"]
3+components = ["rustfmt", "rust-src", "clippy"]