remove unused imports, unused guttercode, and fix a few clippy warnings

This commit is contained in:
Sam Vente 2024-06-09 19:36:33 +02:00
parent d1e2bff16b
commit fb73cc5a40
No known key found for this signature in database
5 changed files with 8 additions and 21 deletions

View File

@ -14,7 +14,7 @@
use helix_parsec::{seq, take_until, Parser};
use helix_stdx::rope::{self, RopeSliceExt};
use smallvec::{smallvec, SmallVec};
use std::{borrow::Cow, iter, slice};
use std::{borrow::Cow, fmt::Display, iter, slice};
use tree_sitter::Node;
/// A single selection range.
@ -390,9 +390,11 @@ pub fn is_single_grapheme(&self, doc: RopeSlice) -> bool {
pub fn into_byte_range(&self, text: RopeSlice) -> (usize, usize) {
(text.char_to_byte(self.from()), text.char_to_byte(self.to()))
}
}
pub fn to_string(self) -> String {
format!("({},{})", self.anchor, self.head)
impl Display for Range {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "({},{})", self.anchor, self.head)
}
}

View File

@ -5,7 +5,7 @@
pub use dap::*;
use futures_util::FutureExt;
use helix_event::status;
use helix_parsec::{sep, seq, take_until, Parser};
use helix_parsec::{seq, take_until, Parser};
use helix_stdx::{
path::expand_tilde,
rope::{self, RopeSliceExt},
@ -18,7 +18,7 @@
use helix_core::{
char_idx_at_visual_offset,
chars::char_is_word,
comment, coords_at_pos,
comment,
doc_formatter::TextFormat,
encoding, find_workspace,
graphemes::{self, next_grapheme_boundary, RevRopeGraphemes},

View File

@ -1,4 +1,3 @@
use std::borrow::Borrow;
use std::fmt::Write;
use std::io::BufReader;
use std::ops::Deref;
@ -510,7 +509,7 @@ fn parse_mark_register_contents(
")"
);
let (_, (_, anchor_str, _, head_str, _)) = range_parser.parse(&s).unwrap();
let anchor: usize = <usize as FromStr>::from_str(anchor_str).unwrap().clone();
let anchor: usize = <usize as FromStr>::from_str(anchor_str).unwrap();
let head: usize = <usize as FromStr>::from_str(head_str).unwrap();
Range {
anchor,

View File

@ -680,8 +680,6 @@ pub enum GutterType {
Spacer,
/// Highlight local changes
Diff,
/// Bookmarks
Mark,
}
impl std::str::FromStr for GutterType {

View File

@ -32,7 +32,6 @@ pub fn style<'doc>(
GutterType::LineNumbers => line_numbers(editor, doc, view, theme, is_focused),
GutterType::Spacer => padding(editor, doc, view, theme, is_focused),
GutterType::Diff => diff(editor, doc, view, theme, is_focused),
GutterType::Mark => mark(editor, doc, view, theme, is_focused),
}
}
@ -42,7 +41,6 @@ pub fn width(self, view: &View, doc: &Document) -> usize {
GutterType::LineNumbers => line_numbers_width(view, doc),
GutterType::Spacer => 1,
GutterType::Diff => 1,
GutterType::Mark => 1,
}
}
}
@ -88,16 +86,6 @@ pub fn diagnostic<'doc>(
)
}
pub fn mark<'doc>(
_editor: &'doc Editor,
doc: &'doc Document,
_view: &View,
theme: &Theme,
_is_focused: bool,
) -> GutterFn<'doc> {
todo!()
}
pub fn diff<'doc>(
_editor: &'doc Editor,
doc: &'doc Document,