Skip to content

Commit

Permalink
Switch signature of bulk buffer closing to use slice of DocumentIds
Browse files Browse the repository at this point in the history
Addresses feedback that accepting an IntoIterator implementor is too
much for an internal. Also possibly saves some moving?
  • Loading branch information
EpocSquadron committed Feb 27, 2022
1 parent d011456 commit 9a94e1d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2079,10 +2079,10 @@ pub mod cmd {

fn buffer_close_by_ids_impl(
editor: &mut Editor,
doc_ids: impl IntoIterator<Item = DocumentId>,
doc_ids: &[DocumentId],
force: bool,
) -> anyhow::Result<()> {
for doc_id in doc_ids {
for &doc_id in doc_ids {
editor.close_document(doc_id, force)?;
}

Expand Down Expand Up @@ -2132,7 +2132,7 @@ pub mod cmd {
_event: PromptEvent,
) -> anyhow::Result<()> {
let document_ids = buffer_gather_paths_impl(cx.editor, args);
buffer_close_by_ids_impl(cx.editor, document_ids, false)
buffer_close_by_ids_impl(cx.editor, &document_ids, false)
}

fn force_buffer_close(
Expand All @@ -2141,7 +2141,7 @@ pub mod cmd {
_event: PromptEvent,
) -> anyhow::Result<()> {
let document_ids = buffer_gather_paths_impl(cx.editor, args);
buffer_close_by_ids_impl(cx.editor, document_ids, true)
buffer_close_by_ids_impl(cx.editor, &document_ids, true)
}

fn buffer_gather_others_impl(editor: &mut Editor) -> Vec<DocumentId> {
Expand All @@ -2159,7 +2159,7 @@ pub mod cmd {
_event: PromptEvent,
) -> anyhow::Result<()> {
let document_ids = buffer_gather_others_impl(cx.editor);
buffer_close_by_ids_impl(cx.editor, document_ids, false)
buffer_close_by_ids_impl(cx.editor, &document_ids, false)
}

fn force_buffer_close_others(
Expand All @@ -2168,7 +2168,7 @@ pub mod cmd {
_event: PromptEvent,
) -> anyhow::Result<()> {
let document_ids = buffer_gather_others_impl(cx.editor);
buffer_close_by_ids_impl(cx.editor, document_ids, true)
buffer_close_by_ids_impl(cx.editor, &document_ids, true)
}

fn buffer_gather_all_impl(editor: &mut Editor) -> Vec<DocumentId> {
Expand All @@ -2181,7 +2181,7 @@ pub mod cmd {
_event: PromptEvent,
) -> anyhow::Result<()> {
let document_ids = buffer_gather_all_impl(cx.editor);
buffer_close_by_ids_impl(cx.editor, document_ids, false)
buffer_close_by_ids_impl(cx.editor, &document_ids, false)
}

fn force_buffer_close_all(
Expand All @@ -2190,7 +2190,7 @@ pub mod cmd {
_event: PromptEvent,
) -> anyhow::Result<()> {
let document_ids = buffer_gather_all_impl(cx.editor);
buffer_close_by_ids_impl(cx.editor, document_ids, true)
buffer_close_by_ids_impl(cx.editor, &document_ids, true)
}

fn write_impl(cx: &mut compositor::Context, path: Option<&Cow<str>>) -> anyhow::Result<()> {
Expand Down

0 comments on commit 9a94e1d

Please sign in to comment.