Skip to content

Commit dc5f530

Browse files
committed
refactor: move arg manipulations into commands
1 parent 0ad53bf commit dc5f530

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/bin/cargo/commands/tree.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,10 @@ subtree of the package given to -p.\n\
205205
no_proc_macro,
206206
};
207207

208+
if opts.graph_features && opts.duplicates {
209+
return Err(format_err!("the `-e features` flag does not support `--duplicates`").into());
210+
}
211+
208212
tree::build_and_print(&ws, &opts)?;
209213
Ok(())
210214
}

src/cargo/ops/tree/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::core::{Package, PackageId, PackageIdSpec, Workspace};
88
use crate::ops::{self, Packages};
99
use crate::util::{CargoResult, Config};
1010
use crate::{drop_print, drop_println};
11-
use anyhow::{bail, Context};
11+
use anyhow::Context;
1212
use graph::Graph;
1313
use std::collections::{HashMap, HashSet};
1414
use std::str::FromStr;
@@ -124,9 +124,6 @@ static ASCII_SYMBOLS: Symbols = Symbols {
124124

125125
/// Entry point for the `cargo tree` command.
126126
pub fn build_and_print(ws: &Workspace<'_>, opts: &TreeOptions) -> CargoResult<()> {
127-
if opts.graph_features && opts.duplicates {
128-
bail!("the `-e features` flag does not support `--duplicates`");
129-
}
130127
let requested_targets = match &opts.target {
131128
Target::All | Target::Host => Vec::new(),
132129
Target::Specific(t) => t.clone(),

0 commit comments

Comments
 (0)