Skip to content

Commit 8e89d48

Browse files
committed
Drop ununsed interface argument from functions
1 parent 5c92282 commit 8e89d48

File tree

5 files changed

+20
-58
lines changed

5 files changed

+20
-58
lines changed

crates/pixi_api/src/context.rs

Lines changed: 12 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ use crate::workspace::add::GitOptions;
1717
use crate::workspace::{DependencyOptions, InitOptions, ReinstallOptions};
1818

1919
pub struct DefaultContext<I: Interface> {
20-
interface: I,
20+
_interface: I,
2121
}
2222

2323
impl<I: Interface> DefaultContext<I> {
2424
pub fn new(interface: I) -> Self {
25-
Self { interface }
25+
Self {
26+
_interface: interface,
27+
}
2628
}
2729

2830
/// Returns all matching package versions sorted by version
@@ -32,14 +34,7 @@ impl<I: Interface> DefaultContext<I> {
3234
channels: IndexSet<Channel>,
3335
platform: Platform,
3436
) -> miette::Result<Option<Vec<RepoDataRecord>>> {
35-
crate::workspace::search::search_exact(
36-
&self.interface,
37-
None,
38-
match_spec,
39-
channels,
40-
platform,
41-
)
42-
.await
37+
crate::workspace::search::search_exact(None, match_spec, channels, platform).await
4338
}
4439

4540
/// Returns all matching packages with their latest versions
@@ -49,8 +44,7 @@ impl<I: Interface> DefaultContext<I> {
4944
channels: IndexSet<Channel>,
5045
platform: Platform,
5146
) -> miette::Result<Option<Vec<RepoDataRecord>>> {
52-
crate::workspace::search::search_wildcard(&self.interface, None, search, channels, platform)
53-
.await
47+
crate::workspace::search::search_wildcard(None, search, channels, platform).await
5448
}
5549
}
5650

@@ -150,7 +144,6 @@ impl<I: Interface> WorkspaceContext<I> {
150144
git_options: GitOptions,
151145
) -> miette::Result<Option<UpdateDeps>> {
152146
crate::workspace::add::add_conda_dep(
153-
&self.interface,
154147
self.workspace_mut()?,
155148
specs,
156149
spec_type,
@@ -166,14 +159,8 @@ impl<I: Interface> WorkspaceContext<I> {
166159
editable: bool,
167160
options: DependencyOptions,
168161
) -> miette::Result<Option<UpdateDeps>> {
169-
crate::workspace::add::add_pypi_dep(
170-
&self.interface,
171-
self.workspace_mut()?,
172-
pypi_deps,
173-
editable,
174-
options,
175-
)
176-
.await
162+
crate::workspace::add::add_pypi_dep(self.workspace_mut()?, pypi_deps, editable, options)
163+
.await
177164
}
178165

179166
pub async fn remove_conda_deps(
@@ -183,7 +170,6 @@ impl<I: Interface> WorkspaceContext<I> {
183170
dep_options: DependencyOptions,
184171
) -> miette::Result<()> {
185172
crate::workspace::remove::remove_conda_deps(
186-
&self.interface,
187173
self.workspace_mut()?,
188174
specs,
189175
spec_type,
@@ -197,13 +183,7 @@ impl<I: Interface> WorkspaceContext<I> {
197183
pypi_deps: PypiDeps,
198184
options: DependencyOptions,
199185
) -> miette::Result<()> {
200-
crate::workspace::remove::remove_pypi_deps(
201-
&self.interface,
202-
self.workspace_mut()?,
203-
pypi_deps,
204-
options,
205-
)
206-
.await
186+
crate::workspace::remove::remove_pypi_deps(self.workspace_mut()?, pypi_deps, options).await
207187
}
208188

209189
pub async fn reinstall(
@@ -224,7 +204,7 @@ impl<I: Interface> WorkspaceContext<I> {
224204
&self,
225205
environment: Option<EnvironmentName>,
226206
) -> miette::Result<HashMap<EnvironmentName, HashMap<TaskName, Task>>> {
227-
crate::workspace::task::list_tasks(&self.interface, &self.workspace, environment).await
207+
crate::workspace::task::list_tasks(&self.workspace, environment).await
228208
}
229209

230210
pub async fn add_task(
@@ -284,7 +264,6 @@ impl<I: Interface> WorkspaceContext<I> {
284264
platform: Platform,
285265
) -> miette::Result<Option<Vec<RepoDataRecord>>> {
286266
crate::workspace::search::search_exact(
287-
&self.interface,
288267
Some(&self.workspace),
289268
match_spec,
290269
channels,
@@ -300,13 +279,7 @@ impl<I: Interface> WorkspaceContext<I> {
300279
channels: IndexSet<Channel>,
301280
platform: Platform,
302281
) -> miette::Result<Option<Vec<RepoDataRecord>>> {
303-
crate::workspace::search::search_wildcard(
304-
&self.interface,
305-
Some(&self.workspace),
306-
search,
307-
channels,
308-
platform,
309-
)
310-
.await
282+
crate::workspace::search::search_wildcard(Some(&self.workspace), search, channels, platform)
283+
.await
311284
}
312285
}

crates/pixi_api/src/workspace/add/mod.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,11 @@ use pixi_manifest::{FeatureName, KnownPreviewFeature, SpecType};
88
use pixi_spec::{GitSpec, SourceLocationSpec, SourceSpec};
99
use rattler_conda_types::{MatchSpec, PackageName};
1010

11-
use crate::interface::Interface;
12-
1311
mod options;
1412

1513
pub use options::{DependencyOptions, GitOptions};
1614

17-
pub async fn add_conda_dep<I: Interface>(
18-
_interface: &I,
15+
pub async fn add_conda_dep(
1916
mut workspace: WorkspaceMut,
2017
specs: IndexMap<PackageName, MatchSpec>,
2118
spec_type: SpecType,
@@ -108,8 +105,7 @@ pub async fn add_conda_dep<I: Interface>(
108105
Ok(update_deps)
109106
}
110107

111-
pub async fn add_pypi_dep<I: Interface>(
112-
_interface: &I,
108+
pub async fn add_pypi_dep(
113109
mut workspace: WorkspaceMut,
114110
pypi_deps: PypiDeps,
115111
editable: bool,

crates/pixi_api/src/workspace/remove/mod.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ use pixi_core::{
99
use pixi_manifest::{FeaturesExt, SpecType};
1010
use rattler_conda_types::{MatchSpec, PackageName};
1111

12-
use crate::{interface::Interface, workspace::DependencyOptions};
12+
use crate::workspace::DependencyOptions;
1313

14-
pub async fn remove_conda_deps<I: Interface>(
15-
_interface: &I,
14+
pub async fn remove_conda_deps(
1615
mut workspace: WorkspaceMut,
1716
specs: IndexMap<PackageName, MatchSpec>,
1817
spec_type: SpecType,
@@ -71,8 +70,7 @@ pub async fn remove_conda_deps<I: Interface>(
7170
Ok(())
7271
}
7372

74-
pub async fn remove_pypi_deps<I: Interface>(
75-
_interface: &I,
73+
pub async fn remove_pypi_deps(
7674
mut workspace: WorkspaceMut,
7775
pypi_deps: PypiDeps,
7876
options: DependencyOptions,

crates/pixi_api/src/workspace/search/mod.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ use rattler_repodata_gateway::{GatewayError, RepoData};
1212
use regex::Regex;
1313
use strsim::jaro;
1414

15-
use crate::Interface;
16-
17-
pub async fn search_exact<I: Interface>(
18-
_interface: &I,
15+
pub async fn search_exact(
1916
workspace: Option<&Workspace>,
2017
match_spec: MatchSpec,
2118
channels: IndexSet<Channel>,
@@ -103,8 +100,7 @@ pub async fn search_exact<I: Interface>(
103100
Ok(Some(packages))
104101
}
105102

106-
pub async fn search_wildcard<I: Interface>(
107-
_interface: &I,
103+
pub async fn search_wildcard(
108104
workspace: Option<&Workspace>,
109105
package_name_filter: &str,
110106
channels: IndexSet<Channel>,

crates/pixi_api/src/workspace/task/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ use rattler_conda_types::Platform;
1313

1414
use crate::interface::Interface;
1515

16-
pub async fn list_tasks<I: Interface>(
17-
_interface: &I,
16+
pub async fn list_tasks(
1817
workspace: &Workspace,
1918
environment: Option<EnvironmentName>,
2019
) -> miette::Result<HashMap<EnvironmentName, HashMap<TaskName, Task>>> {

0 commit comments

Comments
 (0)