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

pull/10905/head
Sam Vente 6 months ago
parent d1e2bff16b
commit fb73cc5a40
No known key found for this signature in database

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

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

@ -1,4 +1,3 @@
use std::borrow::Borrow;
use std::fmt::Write; use std::fmt::Write;
use std::io::BufReader; use std::io::BufReader;
use std::ops::Deref; 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_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(); let head: usize = <usize as FromStr>::from_str(head_str).unwrap();
Range { Range {
anchor, anchor,

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

@ -32,7 +32,6 @@ impl GutterType {
GutterType::LineNumbers => line_numbers(editor, doc, view, theme, is_focused), GutterType::LineNumbers => line_numbers(editor, doc, view, theme, is_focused),
GutterType::Spacer => padding(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::Diff => diff(editor, doc, view, theme, is_focused),
GutterType::Mark => mark(editor, doc, view, theme, is_focused),
} }
} }
@ -42,7 +41,6 @@ impl GutterType {
GutterType::LineNumbers => line_numbers_width(view, doc), GutterType::LineNumbers => line_numbers_width(view, doc),
GutterType::Spacer => 1, GutterType::Spacer => 1,
GutterType::Diff => 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>( pub fn diff<'doc>(
_editor: &'doc Editor, _editor: &'doc Editor,
doc: &'doc Document, doc: &'doc Document,

Loading…
Cancel
Save