Skip to content

Commit

Permalink
Used starts_with() instead of string of calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmatthiggins committed Jul 21, 2022
1 parent 878df05 commit 17faac4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/cargo/ops/cargo_add/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ fn print_msg(shell: &mut Shell, dep: &Dependency, section: &[String]) -> CargoRe
shell.write_stderr(format_args!(" {}\n", feat), &ColorSpec::new())?;
}
for feat in deactivated {
let is_hidden = feat.chars().nth(0).map(|c| c == '_').unwrap_or(false);
let is_hidden = feat.starts_with('_');

if !is_hidden {
shell.write_stderr(&prefix, &ColorSpec::new())?;
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/cargo_add/add_hidden_activated/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use cargo_test_support::curr_dir;
use cargo_test_support::prelude::*;
use cargo_test_support::Project;
use cargo_test_support::curr_dir;

use crate::cargo_add::init_registry;

Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/cargo_add/add_hidden_unactivated/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use cargo_test_support::curr_dir;
use cargo_test_support::prelude::*;
use cargo_test_support::Project;
use cargo_test_support::curr_dir;

use crate::cargo_add::init_registry;

Expand Down

0 comments on commit 17faac4

Please sign in to comment.