aboutsummaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
Diffstat (limited to 'helix-view')
-rw-r--r--helix-view/src/editor.rs11
-rw-r--r--helix-view/src/gutter.rs3
-rw-r--r--helix-view/src/handlers/dap.rs4
3 files changed, 5 insertions, 13 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index 7af28ccc..5a81cb5d 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -727,7 +727,7 @@ pub struct WhitespaceCharacters {
impl Default for WhitespaceCharacters {
fn default() -> Self {
Self {
- space: '·', // U+00B7
+ space: '·', // U+00B7
nbsp: '⍽', // U+237D
tab: '→', // U+2192
newline: '⏎', // U+23CE
@@ -755,12 +755,13 @@ impl Default for IndentGuidesConfig {
}
/// Line ending configuration.
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[derive(Default, Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum LineEndingConfig {
/// The platform's native line ending.
///
/// `crlf` on Windows, otherwise `lf`.
+ #[default]
Native,
/// Line feed.
LF,
@@ -777,12 +778,6 @@ pub enum LineEndingConfig {
Nel,
}
-impl Default for LineEndingConfig {
- fn default() -> Self {
- LineEndingConfig::Native
- }
-}
-
impl From<LineEndingConfig> for LineEnding {
fn from(line_ending: LineEndingConfig) -> Self {
match line_ending {
diff --git a/helix-view/src/gutter.rs b/helix-view/src/gutter.rs
index 397dff4f..ebdac9e2 100644
--- a/helix-view/src/gutter.rs
+++ b/helix-view/src/gutter.rs
@@ -9,8 +9,7 @@ use crate::{
};
fn count_digits(n: usize) -> usize {
- // TODO: use checked_log10 when MSRV reaches 1.67
- std::iter::successors(Some(n), |&n| (n >= 10).then_some(n / 10)).count()
+ (usize::checked_ilog10(n).unwrap_or(0) + 1) as usize
}
pub type GutterFn<'doc> = Box<dyn FnMut(usize, bool, bool, &mut String) -> Option<Style> + 'doc>;
diff --git a/helix-view/src/handlers/dap.rs b/helix-view/src/handlers/dap.rs
index 3da01494..e1437bef 100644
--- a/helix-view/src/handlers/dap.rs
+++ b/helix-view/src/handlers/dap.rs
@@ -369,9 +369,7 @@ impl Editor {
{
Ok(process) => process,
Err(err) => {
- // TODO replace the pretty print {:?} with a regular format {}
- // when the MSRV is raised to 1.60.0
- self.set_error(format!("Error starting external terminal: {:?}", err));
+ self.set_error(format!("Error starting external terminal: {}", err));
return true;
}
};