Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for latest review feedback #672

Merged
merged 13 commits into from
Mar 16, 2022
Prev Previous commit
Next Next commit
style: Chain option combinators
epage committed Mar 16, 2022
commit 1d6e6d88b36738dbb6fee923d6c5c0ace8a0ea2b
9 changes: 5 additions & 4 deletions crates/cargo-add/src/cargo/ops/cargo_add/manifest.rs
Original file line number Diff line number Diff line change
@@ -462,10 +462,11 @@ impl LocalManifest {
for (_, tbl) in self.get_sections() {
if let toml_edit::Item::Table(tbl) = tbl {
if let Some(dep_item) = tbl.get(dep_key) {
let optional = dep_item.get("optional");
let optional = optional.and_then(|i| i.as_value());
let optional = optional.and_then(|i| i.as_bool());
let optional = optional.unwrap_or(false);
let optional = dep_item
.get("optional")
.and_then(|i| i.as_value())
.and_then(|i| i.as_bool())
.unwrap_or(false);
if optional {
return DependencyStatus::Optional;
} else {