on master help sign in
Fix clippy lints (#6454)
commit198ff2c3f9c56afe4649cc0ecbb09ded5fd4a7c7 authorPhilipp Mildenberger <philipp@mildenberger.me> dateTue 28 Mar 2023, 01:33 (4 years ago) parent5323020
4 files changed+8−18
helix-core/src/position.rs+2−2 helix-term/src/commands.rs+2−2 helix-tui/src/widgets/block.rs+2−7 helix-view/src/editor.rs+2−7
helix-core/src/position.rs+2−2
@@ -309,8 +309,8 @@ pub fn pos_at_visual_coords(text: RopeSlice, coords: Position, tab_width: usize)
309309/// on the visual line is returned if the visual line contains any text:
310310/// If the visual line at the specified offset is a virtual line generated by a `LineAnnotation`
311311/// the previous char_index is returned, together with the remaining vertical offset (`virtual_lines`)
312−pub fn char_idx_at_visual_offset<'a>(
313− text: RopeSlice<'a>,
312+pub fn char_idx_at_visual_offset(
313+ text: RopeSlice,
314314 mut anchor: usize,
315315 mut row_offset: isize,
316316 column: usize,
helix-term/src/commands.rs+2−2
@@ -501,7 +501,7 @@ impl std::str::FromStr for MappableCommand {
501501
502502 fn from_str(s: &str) -> Result<Self, Self::Err> {
503503 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());
505505 let name = typable_command
506506 .next()
507507 .ok_or_else(|| anyhow!("Expected typable command name"))?;
@@ -1470,7 +1470,7 @@ pub fn scroll(cx: &mut Context, offset: usize, direction: Direction) {
14701470 let cursor = range.cursor(text);
14711471 let height = view.inner_height();
14721472
1473− let scrolloff = config.scrolloff.min(height.saturating_sub(1) as usize / 2);
1473+ let scrolloff = config.scrolloff.min(height.saturating_sub(1) / 2);
14741474 let offset = match direction {
14751475 Forward => offset as isize,
14761476 Backward => -(offset as isize),
helix-tui/src/widgets/block.rs+2−7
@@ -7,8 +7,9 @@ use crate::{
77use helix_view::graphics::{Rect, Style};
88
99/// Border render type. Defaults to [`BorderType::Plain`].
10−#[derive(Debug, Clone, Copy, PartialEq, Eq)]
10+#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
1111pub enum BorderType {
12+ #[default]
1213 Plain,
1314 Rounded,
1415 Double,
@@ -26,12 +27,6 @@ impl BorderType {
2627 }
2728}
2829
29−impl Default for BorderType {
30− fn default() -> BorderType {
31− BorderType::Plain
32− }
33−}
34−
3530/// Base widget to be used with all upper level ones. It may be used to display a box border around
3631/// the widget and/or add a title.
3732///
helix-view/src/editor.rs+2−7
@@ -532,10 +532,11 @@ impl Default for CursorShapeConfig {
532532}
533533
534534/// bufferline render modes
535−#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
535+#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
536536#[serde(rename_all = "kebab-case")]
537537pub enum BufferLine {
538538 /// Don't render bufferline
539+ #[default]
539540 Never,
540541 /// Always render
541542 Always,
@@ -543,12 +544,6 @@ pub enum BufferLine {
543544 Multiple,
544545}
545546
546−impl Default for BufferLine {
547− fn default() -> Self {
548− BufferLine::Never
549− }
550−}
551−
552547#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
553548#[serde(rename_all = "kebab-case")]
554549pub enum LineNumber {