Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
gibbz00 committed Feb 19, 2023
1 parent e460f87 commit 42c1d81
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 63 deletions.
2 changes: 1 addition & 1 deletion helix-term/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use tui::backend::Backend;
use crate::{
args::Args,
commands::apply_workspace_edit,
compositor::{Compositor, Event, CompositorContext},
compositor::{Compositor, CompositorContext, Event},
config::Config,
job::Jobs,
keymap::Keymaps,
Expand Down
60 changes: 10 additions & 50 deletions helix-term/src/commands/typed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,7 @@ fn write_impl(
Ok(())
}

fn write(
cx: &mut CompositorContext,
args: &[Cow<str>],
event: PromptEvent,
) -> anyhow::Result<()> {
fn write(cx: &mut CompositorContext, args: &[Cow<str>], event: PromptEvent) -> anyhow::Result<()> {
if event != PromptEvent::Validate {
return Ok(());
}
Expand Down Expand Up @@ -507,11 +503,7 @@ fn earlier(
Ok(())
}

fn later(
cx: &mut CompositorContext,
args: &[Cow<str>],
event: PromptEvent,
) -> anyhow::Result<()> {
fn later(cx: &mut CompositorContext, args: &[Cow<str>], event: PromptEvent) -> anyhow::Result<()> {
if event != PromptEvent::Validate {
return Ok(());
}
Expand Down Expand Up @@ -730,11 +722,7 @@ fn force_quit_all(
quit_all_impl(cx, true)
}

fn cquit(
cx: &mut CompositorContext,
args: &[Cow<str>],
event: PromptEvent,
) -> anyhow::Result<()> {
fn cquit(cx: &mut CompositorContext, args: &[Cow<str>], event: PromptEvent) -> anyhow::Result<()> {
if event != PromptEvent::Validate {
return Ok(());
}
Expand Down Expand Up @@ -766,11 +754,7 @@ fn force_cquit(
quit_all_impl(cx, true)
}

fn theme(
cx: &mut CompositorContext,
args: &[Cow<str>],
event: PromptEvent,
) -> anyhow::Result<()> {
fn theme(cx: &mut CompositorContext, args: &[Cow<str>], event: PromptEvent) -> anyhow::Result<()> {
let true_color = cx.editor.config.load().true_color || crate::true_color();
match event {
PromptEvent::Abort => {
Expand Down Expand Up @@ -1232,11 +1216,7 @@ fn reload_all(
}

/// Update the [`Document`] if it has been modified.
fn update(
cx: &mut CompositorContext,
args: &[Cow<str>],
event: PromptEvent,
) -> anyhow::Result<()> {
fn update(cx: &mut CompositorContext, args: &[Cow<str>], event: PromptEvent) -> anyhow::Result<()> {
if event != PromptEvent::Validate {
return Ok(());
}
Expand Down Expand Up @@ -1387,11 +1367,7 @@ fn tree_sitter_scopes(
Ok(())
}

fn vsplit(
cx: &mut CompositorContext,
args: &[Cow<str>],
event: PromptEvent,
) -> anyhow::Result<()> {
fn vsplit(cx: &mut CompositorContext, args: &[Cow<str>], event: PromptEvent) -> anyhow::Result<()> {
if event != PromptEvent::Validate {
return Ok(());
}
Expand All @@ -1410,11 +1386,7 @@ fn vsplit(
Ok(())
}

fn hsplit(
cx: &mut CompositorContext,
args: &[Cow<str>],
event: PromptEvent,
) -> anyhow::Result<()> {
fn hsplit(cx: &mut CompositorContext, args: &[Cow<str>], event: PromptEvent) -> anyhow::Result<()> {
if event != PromptEvent::Validate {
return Ok(());
}
Expand Down Expand Up @@ -1525,11 +1497,7 @@ fn debug_remote(
dap_start_impl(cx, name.as_deref(), address, Some(args))
}

fn tutor(
cx: &mut CompositorContext,
_args: &[Cow<str>],
event: PromptEvent,
) -> anyhow::Result<()> {
fn tutor(cx: &mut CompositorContext, _args: &[Cow<str>], event: PromptEvent) -> anyhow::Result<()> {
if event != PromptEvent::Validate {
return Ok(());
}
Expand Down Expand Up @@ -1743,11 +1711,7 @@ fn sort_reverse(
sort_impl(cx, args, true)
}

fn sort_impl(
cx: &mut CompositorContext,
_args: &[Cow<str>],
reverse: bool,
) -> anyhow::Result<()> {
fn sort_impl(cx: &mut CompositorContext, _args: &[Cow<str>], reverse: bool) -> anyhow::Result<()> {
let scrolloff = cx.editor.config().scrolloff;
let (view, doc) = current!(cx.editor);
let text = doc.text().slice(..);
Expand Down Expand Up @@ -1779,11 +1743,7 @@ fn sort_impl(
Ok(())
}

fn reflow(
cx: &mut CompositorContext,
args: &[Cow<str>],
event: PromptEvent,
) -> anyhow::Result<()> {
fn reflow(cx: &mut CompositorContext, args: &[Cow<str>], event: PromptEvent) -> anyhow::Result<()> {
if event != PromptEvent::Validate {
return Ok(());
}
Expand Down
5 changes: 4 additions & 1 deletion helix-term/src/ui/completion.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use crate::{compositor::{Component, CompositorContext, Event, EventResult}, commands::CommandContext};
use crate::{
commands::CommandContext,
compositor::{Component, CompositorContext, Event, EventResult},
};
use helix_view::{
editor::CompleteAction,
theme::{Modifier, Style},
Expand Down
14 changes: 3 additions & 11 deletions helix-term/src/ui/editor.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{
commands::{self, OnKeyCallback, CommandContext},
commands::{self, CommandContext, OnKeyCallback},
compositor::{Component, CompositorContext, Event, EventResult},
job::{self, Callback},
key,
Expand Down Expand Up @@ -997,11 +997,7 @@ impl EditorView {
}

impl EditorView {
fn handle_mouse_event(
&mut self,
event: &MouseEvent,
cxt: &mut CommandContext,
) -> EventResult {
fn handle_mouse_event(&mut self, event: &MouseEvent, cxt: &mut CommandContext) -> EventResult {
let config = cxt.editor.config();
let MouseEvent {
kind,
Expand Down Expand Up @@ -1182,11 +1178,7 @@ impl EditorView {
}

impl Component for EditorView {
fn handle_event(
&mut self,
event: &Event,
context: &mut CompositorContext,
) -> EventResult {
fn handle_event(&mut self, event: &Event, context: &mut CompositorContext) -> EventResult {
let mut cx = CommandContext {
editor: context.editor,
count: None,
Expand Down

0 comments on commit 42c1d81

Please sign in to comment.