From 4314cebfbb2240c51d768c3f46fc34cb38c1ae07 Mon Sep 17 00:00:00 2001
From: Awiteb
Date: Mon, 5 May 2025 19:49:56 +0000
Subject: [PATCH] chore: Take the ownership in the `CommandRunner` trait
Signed-off-by: Awiteb
---
src/cli/mod.rs | 2 +-
src/cli/repo/mod.rs | 2 +-
src/cli/repo/view.rs | 2 +-
src/cli/traits.rs | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/cli/mod.rs b/src/cli/mod.rs
index 6ae4a92..0f9a257 100644
--- a/src/cli/mod.rs
+++ b/src/cli/mod.rs
@@ -103,7 +103,7 @@ impl Cli {
}
impl CommandRunner for Commands {
- async fn run(&self, options: CliOptions) -> N34Result<()> {
+ async fn run(self, options: CliOptions) -> N34Result<()> {
tracing::trace!("Options: {options:#?}");
tracing::trace!("Handling: {self:#?}");
match self {
diff --git a/src/cli/repo/mod.rs b/src/cli/repo/mod.rs
index abb9fae..9b4ed46 100644
--- a/src/cli/repo/mod.rs
+++ b/src/cli/repo/mod.rs
@@ -30,7 +30,7 @@ pub enum RepoSubcommands {
}
impl CommandRunner for RepoSubcommands {
- async fn run(&self, options: CliOptions) -> N34Result<()> {
+ async fn run(self, options: CliOptions) -> N34Result<()> {
match self {
Self::View(args) => args.run(options).await,
}
diff --git a/src/cli/repo/view.rs b/src/cli/repo/view.rs
index 610a934..b9db20d 100644
--- a/src/cli/repo/view.rs
+++ b/src/cli/repo/view.rs
@@ -34,7 +34,7 @@ pub struct ViewArgs {
}
impl CommandRunner for ViewArgs {
- async fn run(&self, options: CliOptions) -> N34Result<()> {
+ async fn run(self, options: CliOptions) -> N34Result<()> {
let client = NostrClient::init(&options).await;
if !self.naddr.relays.is_empty() {
client.add_read_relays(&self.naddr.relays).await;
diff --git a/src/cli/traits.rs b/src/cli/traits.rs
index 1d9d299..317367d 100644
--- a/src/cli/traits.rs
+++ b/src/cli/traits.rs
@@ -20,5 +20,5 @@ use crate::error::N34Result;
/// A trait defining the interface for command runners in the CLI.
pub trait CommandRunner {
/// Executes the command and returns a Result indicating success or failure.
- async fn run(&self, options: CliOptions) -> N34Result<()>;
+ async fn run(self, options: CliOptions) -> N34Result<()>;
}