From afd292e3b9616ea9098ca3a7d24a730508b84809 Mon Sep 17 00:00:00 2001 From: Omnikar Date: Thu, 4 Aug 2022 01:32:59 -0400 Subject: [PATCH] Resolve clippy lints (#3307) --- helix-core/src/increment/date_time.rs | 3 ++- helix-term/src/ui/editor.rs | 2 +- helix-view/src/handlers/dap.rs | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/helix-core/src/increment/date_time.rs b/helix-core/src/increment/date_time.rs index 91fa5963..1574bf4d 100644 --- a/helix-core/src/increment/date_time.rs +++ b/helix-core/src/increment/date_time.rs @@ -5,6 +5,7 @@ use ropey::RopeSlice; use std::borrow::Cow; use std::cmp; +use std::fmt::Write; use super::Increment; use crate::{Range, Tendril}; @@ -162,7 +163,7 @@ impl Format { fields.push(field); max_len += field.max_len + remaining[..i].len(); regex += &remaining[..i]; - regex += &format!("({})", field.regex); + write!(regex, "({})", field.regex).unwrap(); remaining = &after[spec_len..]; } diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 6ed9799b..f5598095 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -1011,7 +1011,7 @@ impl EditorView { None => return EventResult::Ignored(None), } - let offset = config.scroll_lines.abs() as usize; + let offset = config.scroll_lines.unsigned_abs(); commands::scroll(cxt, offset, direction); cxt.editor.tree.focus = current_view; diff --git a/helix-view/src/handlers/dap.rs b/helix-view/src/handlers/dap.rs index ae1ae64c..4d197680 100644 --- a/helix-view/src/handlers/dap.rs +++ b/helix-view/src/handlers/dap.rs @@ -4,6 +4,7 @@ use helix_core::Selection; use helix_dap::{self as dap, Client, Payload, Request, ThreadId}; use helix_lsp::block_on; use log::warn; +use std::fmt::Write; use std::io::ErrorKind; use std::path::PathBuf; @@ -180,10 +181,10 @@ impl Editor { let mut status = format!("{} stopped because of {}", scope, reason); if let Some(desc) = description { - status.push_str(&format!(" {}", desc)); + write!(status, " {}", desc).unwrap(); } if let Some(text) = text { - status.push_str(&format!(" {}", text)); + write!(status, " {}", text).unwrap(); } if all_threads_stopped { status.push_str(" (all threads stopped)");