Skip to content

Commit

Permalink
Resolve clippy warnings (#1759)
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed Feb 8, 2023
1 parent 88599b4 commit 33856a5
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/bridge/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ fn nvim_cmd_impl(bin: &str, args: &[String]) -> TokioCommand {
fn nvim_cmd_impl(bin: &str, args: &[String]) -> TokioCommand {
if cfg!(target_os = "windows") && SETTINGS.get::<CmdLineSettings>().wsl {
let mut cmd = TokioCommand::new("wsl");
cmd.args(&["$SHELL", "-lc", &format!("{} {}", bin, args.join(" "))]);
cmd.args(["$SHELL", "-lc", &format!("{} {}", bin, args.join(" "))]);
cmd
} else {
let mut cmd = TokioCommand::new(bin);
Expand Down
2 changes: 1 addition & 1 deletion src/editor/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::editor::style::{Colors, Style};

use super::grid::GridCell;

#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, Eq, PartialEq)]
pub enum CursorShape {
Block,
Horizontal,
Expand Down
6 changes: 4 additions & 2 deletions src/editor/draw_command_batcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ impl DrawCommandBatcher {
}
}

pub fn queue(&self, draw_command: DrawCommand) -> Result<(), SendError<DrawCommand>> {
self.window_draw_command_sender.send(draw_command)
pub fn queue(&self, draw_command: DrawCommand) -> Result<(), Box<SendError<DrawCommand>>> {
self.window_draw_command_sender
.send(draw_command)
.map_err(Box::new)
}

pub fn send_batch(&self) {
Expand Down
4 changes: 2 additions & 2 deletions src/editor/style.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use skia_safe::Color4f;

#[derive(new, PartialEq, Debug, Clone)]
#[derive(new, Debug, Clone, PartialEq)]
pub struct Colors {
pub foreground: Option<Color4f>,
pub background: Option<Color4f>,
pub special: Option<Color4f>,
}

#[derive(PartialEq, Debug, Clone, Copy)]
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub enum UnderlineStyle {
Underline,
UnderDouble,
Expand Down
2 changes: 1 addition & 1 deletion src/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use core::fmt;
use clap::{builder::PossibleValue, ValueEnum};

// Options for the frame decorations
#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub enum Frame {
Full,
#[cfg(target_os = "macos")]
Expand Down
16 changes: 8 additions & 8 deletions src/renderer/cursor_renderer/cursor_vfx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@ pub trait CursorVfx {
);
}

#[derive(Clone, PartialEq)]
#[derive(Clone, Eq, PartialEq)]
pub enum HighlightMode {
SonicBoom,
Ripple,
Wireframe,
}

#[derive(Clone, PartialEq)]
#[derive(Clone, Eq, PartialEq)]
pub enum TrailMode {
Railgun,
Torpedo,
PixieDust,
}

#[derive(Clone, PartialEq)]
#[derive(Clone, Eq, PartialEq)]
pub enum VfxMode {
Highlight(HighlightMode),
Trail(TrailMode),
Expand Down Expand Up @@ -159,17 +159,17 @@ impl CursorVfx for PointHighlight {

match self.mode {
HighlightMode::SonicBoom => {
canvas.draw_oval(&rect, &paint);
canvas.draw_oval(rect, &paint);
}
HighlightMode::Ripple => {
paint.set_style(Style::Stroke);
paint.set_stroke_width(cursor_height as f32 * 0.2);
canvas.draw_oval(&rect, &paint);
canvas.draw_oval(rect, &paint);
}
HighlightMode::Wireframe => {
paint.set_style(Style::Stroke);
paint.set_stroke_width(cursor_height as f32 * 0.2);
canvas.draw_rect(&rect, &paint);
canvas.draw_rect(rect, &paint);
}
}
}
Expand Down Expand Up @@ -355,10 +355,10 @@ impl CursorVfx for ParticleTrail {

match self.trail_mode {
TrailMode::Torpedo | TrailMode::Railgun => {
canvas.draw_oval(&rect, &paint);
canvas.draw_oval(rect, &paint);
}
TrailMode::PixieDust => {
canvas.draw_rect(&rect, &paint);
canvas.draw_rect(rect, &paint);
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/cursor_renderer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ impl CursorRenderer {

for blob in blobs.iter() {
canvas.draw_text_blob(
&blob,
blob,
(self.destination.x, self.destination.y + y_adjustment as f32),
&paint,
);
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ impl Renderer {

if let Some(root_window) = self.rendered_windows.get(&1) {
let clip_rect = root_window.pixel_region(font_dimensions);
root_canvas.clip_rect(&clip_rect, None, Some(false));
root_canvas.clip_rect(clip_rect, None, Some(false));
}

let windows: Vec<&mut RenderedWindow> = {
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/rendered_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub enum WindowDrawCommand {
},
}

#[derive(Copy, Clone, Debug, PartialEq)]
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub struct WindowPadding {
pub top: u32,
pub left: u32,
Expand Down Expand Up @@ -268,7 +268,7 @@ impl RenderedWindow {
let pixel_region = self.pixel_region(font_dimensions);

root_canvas.save();
root_canvas.clip_rect(&pixel_region, None, Some(false));
root_canvas.clip_rect(pixel_region, None, Some(false));

if self.floating_order.is_none() {
root_canvas.clear(default_background);
Expand Down

0 comments on commit 33856a5

Please sign in to comment.