on master help sign in
Fix clippy lints (#6454)
198ff2cPhilipp Mildenberger
helix-core/src/position.rs+2−2
@@ -309,8 +309,8 @@ pub fn pos_at_visual_coords(text: RopeSlice, coords: Position, tab_width: usize)
309/// on the visual line is returned if the visual line contains any text:
309/// on the visual line is returned if the visual line contains any text:
310/// If the visual line at the specified offset is a virtual line generated by a `LineAnnotation`
310/// If the visual line at the specified offset is a virtual line generated by a `LineAnnotation`
311/// the previous char_index is returned, together with the remaining vertical offset (`virtual_lines`)
311/// the previous char_index is returned, together with the remaining vertical offset (`virtual_lines`)
312−pub fn char_idx_at_visual_offset<'a>(
312+pub fn char_idx_at_visual_offset(
313− text: RopeSlice<'a>,
313+ text: RopeSlice,
314 mut anchor: usize,
314 mut anchor: usize,
315 mut row_offset: isize,
315 mut row_offset: isize,
316 column: usize,
316 column: usize,
helix-term/src/commands.rs+2−2
@@ -501,7 +501,7 @@ impl std::str::FromStr for MappableCommand {
501
501
502 fn from_str(s: &str) -> Result<Self, Self::Err> {
502 fn from_str(s: &str) -> Result<Self, Self::Err> {
503 if let Some(suffix) = s.strip_prefix(':') {
503 if let Some(suffix) = s.strip_prefix(':') {
504− let mut typable_command = suffix.split(' ').into_iter().map(|arg| arg.trim());
504+ let mut typable_command = suffix.split(' ').map(|arg| arg.trim());
505 let name = typable_command
505 let name = typable_command
506 .next()
506 .next()
507 .ok_or_else(|| anyhow!("Expected typable command name"))?;
507 .ok_or_else(|| anyhow!("Expected typable command name"))?;
@@ -1470,7 +1470,7 @@ pub fn scroll(cx: &mut Context, offset: usize, direction: Direction) {
1470 let cursor = range.cursor(text);
1470 let cursor = range.cursor(text);
1471 let height = view.inner_height();
1471 let height = view.inner_height();
1472
1472
1473− let scrolloff = config.scrolloff.min(height.saturating_sub(1) as usize / 2);
1473+ let scrolloff = config.scrolloff.min(height.saturating_sub(1) / 2);
1474 let offset = match direction {
1474 let offset = match direction {
1475 Forward => offset as isize,
1475 Forward => offset as isize,
1476 Backward => -(offset as isize),
1476 Backward => -(offset as isize),
helix-tui/src/widgets/block.rs+2−7
@@ -7,8 +7,9 @@ use crate::{
7use helix_view::graphics::{Rect, Style};
7use helix_view::graphics::{Rect, Style};
8
8
9/// Border render type. Defaults to [`BorderType::Plain`].
9/// Border render type. Defaults to [`BorderType::Plain`].
10−#[derive(Debug, Clone, Copy, PartialEq, Eq)]
10+#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
11pub enum BorderType {
11pub enum BorderType {
12+ #[default]
12 Plain,
13 Plain,
13 Rounded,
14 Rounded,
14 Double,
15 Double,
@@ -26,12 +27,6 @@ impl BorderType {
26 }
27 }
27}
28}
28
29
29−impl Default for BorderType {
30− fn default() -> BorderType {
31− BorderType::Plain
32− }
33−}
34−
35/// Base widget to be used with all upper level ones. It may be used to display a box border around
30/// Base widget to be used with all upper level ones. It may be used to display a box border around
36/// the widget and/or add a title.
31/// the widget and/or add a title.
37///
32///
helix-view/src/editor.rs+2−7
@@ -532,10 +532,11 @@ impl Default for CursorShapeConfig {
532}
532}
533
533
534/// bufferline render modes
534/// bufferline render modes
535−#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
535+#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
536#[serde(rename_all = "kebab-case")]
536#[serde(rename_all = "kebab-case")]
537pub enum BufferLine {
537pub enum BufferLine {
538 /// Don't render bufferline
538 /// Don't render bufferline
539+ #[default]
539 Never,
540 Never,
540 /// Always render
541 /// Always render
541 Always,
542 Always,
@@ -543,12 +544,6 @@ pub enum BufferLine {
543 Multiple,
544 Multiple,
544}
545}
545
546
546−impl Default for BufferLine {
547− fn default() -> Self {
548− BufferLine::Never
549− }
550−}
551−
552#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
547#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
553#[serde(rename_all = "kebab-case")]
548#[serde(rename_all = "kebab-case")]
554pub enum LineNumber {
549pub enum LineNumber {