Skip to content

Commit

Permalink
use nightly toolchain and remove box for apps fn
Browse files Browse the repository at this point in the history
  • Loading branch information
jewlexx committed Nov 27, 2024
1 parent 0848156 commit 38ba584
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
channel = "stable"
channel = "nightly-2024-11-27"
targets = [
"aarch64-pc-windows-msvc",
"i686-pc-windows-msvc",
Expand Down
6 changes: 3 additions & 3 deletions src/commands/app/cleanup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ impl super::Command for Args {
}

impl Args {
fn list_apps<C: ScoopContext>(&self) -> ListApps<C> {
fn list_apps<C: ScoopContext>(&self) -> impl ListApps<C> + use<C> {
let all = self.all;
Box::new(move |ctx: &C| {
move |ctx: &C| {
if all {
let installed_apps: Vec<package::Reference> = {
let installed_apps = ctx.installed_apps()?;
Expand All @@ -72,6 +72,6 @@ impl Args {
} else {
anyhow::Ok(None)
}
})
}
}
}
10 changes: 5 additions & 5 deletions src/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ use sprinkles::packages::reference::package;

use crate::output::colours::{bright_red, green, yellow};

pub type ListApps<C> = Box<dyn Fn(&C) -> anyhow::Result<Option<Vec<package::Reference>>>>;
pub trait ListApps<C: ?Sized> = Fn(&C) -> anyhow::Result<Option<Vec<package::Reference>>>;

pub struct AppsDecider<'c, C: ?Sized> {
pub struct AppsDecider<'c, C: ?Sized, F: ListApps<C>> {
ctx: &'c C,
all: ListApps<C>,
all: F,
provided: Vec<package::Reference>,
collections: CollectionNames,
}

impl<'c, C: ?Sized> AppsDecider<'c, C> {
pub fn new(ctx: &'c C, all: ListApps<C>, provided: Vec<package::Reference>) -> Self {
impl<'c, C: ?Sized, F: ListApps<C>> AppsDecider<'c, C, F> {
pub fn new(ctx: &'c C, all: F, provided: Vec<package::Reference>) -> Self {
Self {
ctx,
all,
Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
rust_2018_idioms,
rust_2024_compatibility
)]
#![feature(trait_alias)]

// TODO: Replace regex with glob

Expand Down

0 comments on commit 38ba584

Please sign in to comment.