Skip to content

Commit

Permalink
refactor: remove unused functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Hofer-Julian committed Aug 13, 2024
1 parent 4d550ec commit b4427f9
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 61 deletions.
2 changes: 1 addition & 1 deletion src/lock_file/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ impl<'p> UpdateContextBuilder<'p> {

/// Sets the io concurrency semaphore to use when updating environments.
#[allow(unused)]
pub(crate) fn with_io_concurrency_semaphore(self, io_concurrency_limit: IoConcurrencyLimit) -> Self {
pub fn with_io_concurrency_semaphore(self, io_concurrency_limit: IoConcurrencyLimit) -> Self {
Self {
io_concurrency_limit: Some(io_concurrency_limit),
..self
Expand Down
7 changes: 0 additions & 7 deletions src/project/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,6 @@ impl<'p> Environment<'p> {
})
}

/// Returns the manifest definition of this environment. See the
/// documentation of [`Environment`] for an overview of the difference
/// between [`manifest::Environment`] and [`Environment`].
pub(crate) fn environment_manifest(&self) -> &'p manifest::Environment {
self.environment
}

/// Returns the directory where this environment is stored.
pub fn dir(&self) -> std::path::PathBuf {
self.project
Expand Down
43 changes: 2 additions & 41 deletions src/project/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use async_once_cell::OnceCell as AsyncCell;
pub use environment::Environment;
pub use has_project_ref::HasProjectRef;
use indexmap::Equivalent;
use miette::{IntoDiagnostic, NamedSource};
use miette::IntoDiagnostic;
use once_cell::sync::OnceCell;
use pixi_config::Config;
use pixi_consts::consts;
Expand All @@ -38,10 +38,7 @@ pub use solve_group::SolveGroup;
use url::{ParseError, Url};
use xxhash_rust::xxh3::xxh3_64;

use crate::{
activation::{initialize_env_variables, CurrentEnvVarBehavior},
project::grouped_environment::GroupedEnvironment,
};
use crate::activation::{initialize_env_variables, CurrentEnvVarBehavior};

static CUSTOM_TARGET_DIR_WARN: OnceCell<()> = OnceCell::new();

Expand Down Expand Up @@ -208,12 +205,6 @@ impl Project {
Self::from_path(&project_toml)
}

/// Returns the source code of the project as [`NamedSource`].
/// Used in error reporting.
pub(crate) fn manifest_named_source(&self) -> NamedSource<String> {
NamedSource::new(self.manifest.file_name(), self.manifest.contents.clone())
}

/// Loads a project from manifest file.
pub fn from_path(manifest_path: &Path) -> miette::Result<Self> {
let manifest = Manifest::from_path(manifest_path)?;
Expand Down Expand Up @@ -481,31 +472,6 @@ impl Project {
})
}

/// Return the grouped environments, which are all solve-groups and the
/// environments that need to be solved.
pub(crate) fn grouped_environments(&self) -> Vec<GroupedEnvironment> {
let mut environments = HashSet::new();
environments.extend(
self.environments()
.into_iter()
.filter(|env| env.solve_group().is_none())
.map(GroupedEnvironment::from),
);
environments.extend(
self.solve_groups()
.into_iter()
.map(GroupedEnvironment::from),
);
environments.into_iter().collect()
}

/// Returns true if the project contains any reference pypi dependencies.
/// Even if just `[pypi-dependencies]` is specified without any
/// requirements this will return true.
pub(crate) fn has_pypi_dependencies(&self) -> bool {
self.manifest.has_pypi_dependencies()
}

/// Returns the reqwest client used for http networking
pub(crate) fn client(&self) -> &reqwest::Client {
&self.client_and_authenticated_client().0
Expand Down Expand Up @@ -617,11 +583,6 @@ impl Project {
pub fn manifest(&self) -> &Manifest {
&self.manifest
}

/// Convert the project into its manifest
pub(crate) fn into_manifest(self) -> Manifest {
self.manifest
}
}

impl<'source> HasManifestRef<'source> for &'source Project {
Expand Down
5 changes: 0 additions & 5 deletions src/task/executable_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,6 @@ impl<'p> ExecutableTask<'p> {
self.task.as_ref()
}

/// Returns any additional args to pass to the execution of the task.
pub(crate) fn additional_args(&self) -> &[String] {
&self.additional_args
}

/// Returns the project in which this task is defined.
pub(crate) fn project(&self) -> &'p Project {
self.project
Expand Down
2 changes: 1 addition & 1 deletion src/task/task_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl<'p> TaskNode<'p> {
///
/// This function returns `None` if the task does not define a command to
/// execute. This is the case for alias only commands.
pub(crate) fn full_command(&self) -> Option<String> {
pub fn full_command(&self) -> Option<String> {
let mut cmd = self.task.as_single_command()?.to_string();

if !self.additional_args.is_empty() {
Expand Down
6 changes: 0 additions & 6 deletions src/task/task_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ impl From<String> for ComputationHash {
}
}

impl ComputationHash {
pub(crate) fn as_str(&self) -> &str {
&self.0
}
}

impl Display for ComputationHash {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
Expand Down

0 comments on commit b4427f9

Please sign in to comment.