Skip to content

Commit

Permalink
Remove tracking of bin target packages
Browse files Browse the repository at this point in the history
Not needed anymore for profile detection
  • Loading branch information
TimJentzsch committed Dec 26, 2024
1 parent 57837e2 commit 07753df
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/run/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use crate::{
};

pub use self::args::RunArgs;
use self::cargo::metadata::Package;

mod args;
mod serve;
Expand Down Expand Up @@ -68,7 +67,6 @@ pub fn run(args: &RunArgs) -> anyhow::Result<()> {

#[derive(Debug, Clone)]
pub(crate) struct BinTarget {
pub(crate) package: Package,
/// The path to the directory in `target` which contains the binary.
pub(crate) artifact_directory: PathBuf,
/// The name of the binary (without any extensions).
Expand Down Expand Up @@ -106,15 +104,14 @@ pub(crate) fn select_run_binary(

let mut is_example = false;

let (target, package) = if let Some(bin_name) = bin_name {
let target = if let Some(bin_name) = bin_name {
// The user specified a concrete binary
let bins: Vec<_> = packages
.iter()
.flat_map(|package| {
package
.bin_targets()
.filter(|target| target.name == *bin_name)
.map(move |target| (target, package))
})
.collect();

Expand All @@ -133,7 +130,6 @@ pub(crate) fn select_run_binary(
package
.example_targets()
.filter(|target| target.name == *example_name)
.map(move |target| (target, package))
})
.collect();

Expand All @@ -151,7 +147,7 @@ pub(crate) fn select_run_binary(
// If there is only one binary, pick that one
let bins: Vec<_> = packages
.iter()
.flat_map(|package| package.bin_targets().map(move |target| (target, package)))
.flat_map(|package| package.bin_targets())
.collect();

if bins.is_empty() {
Expand All @@ -175,7 +171,7 @@ pub(crate) fn select_run_binary(
let default_run = default_runs[0];
*bins
.iter()
.find(|(bin, _)| bin.name == *default_run)
.find(|bin| bin.name == *default_run)
.ok_or_else(|| {
anyhow::anyhow!("Didn't find `default_run` binary {default_run}")
})?
Expand All @@ -197,7 +193,6 @@ pub(crate) fn select_run_binary(
}

Ok(BinTarget {
package: (**package).clone(),
bin_name: target.name.clone(),
artifact_directory,
})
Expand Down

0 comments on commit 07753df

Please sign in to comment.