Skip to content

Commit

Permalink
Update cargo_metadata requirement from 0.18.1 to 0.19.1 (#889)
Browse files Browse the repository at this point in the history
* Update cargo_metadata requirement from 0.18.1 to 0.19.1

Updates the requirements on [cargo_metadata](https://github.com/oli-obk/cargo_metadata) to permit the latest version.
- [Release notes](https://github.com/oli-obk/cargo_metadata/releases)
- [Changelog](https://github.com/oli-obk/cargo_metadata/blob/main/CHANGELOG.md)
- [Commits](oli-obk/cargo_metadata@0.18.1...0.19.1)

---
updated-dependencies:
- dependency-name: cargo_metadata
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Update for breaking API changes

Fixes:

```
error[E0308]: mismatched types
  --> libcnb-package/src/cargo.rs:51:26
   |
51 |     target.kind.contains(&String::from("bin"))
   |                 -------- ^^^^^^^^^^^^^^^^^^^^ expected `&TargetKind`, found `&String`
   |                 |
   |                 arguments to this method are incorrect
   |
   = note: expected reference `&cargo_metadata::TargetKind`
              found reference `&std::string::String`
```

Due to:
oli-obk/cargo_metadata#258

However, we can use this simpler API instead:
https://docs.rs/cargo_metadata/latest/cargo_metadata/struct.Target.html#method.is_bin

* Inline `is_binary_target`

Since it's only used once and its implementation is now trivial.

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ed Morley <[email protected]>
  • Loading branch information
dependabot[bot] and edmorley authored Dec 10, 2024
1 parent 711fc1b commit 425f2cf
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion libcnb-package/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ include = ["src/**/*", "LICENSE", "README.md"]
workspace = true

[dependencies]
cargo_metadata = "0.18.1"
cargo_metadata = "0.19.1"
ignore = "0.4.23"
indoc = "2.0.5"
libcnb-common.workspace = true
Expand Down
6 changes: 1 addition & 5 deletions libcnb-package/src/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ fn cargo_binary_target_names_from_root_package(
root_package
.targets
.iter()
.filter_map(|target| is_binary_target(target).then_some(target.name.clone()))
.filter_map(|target| target.is_bin().then_some(target.name.clone()))
.collect()
}

fn is_binary_target(target: &cargo_metadata::Target) -> bool {
target.kind.contains(&String::from("bin"))
}
2 changes: 1 addition & 1 deletion libcnb-proc-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ proc-macro = true
workspace = true

[dependencies]
cargo_metadata = "0.18.1"
cargo_metadata = "0.19.1"
fancy-regex = { version = "0.14.0", default-features = false, features = ["std"] }
quote = "1.0.37"
syn = { version = "2.0.87", features = ["full"] }

0 comments on commit 425f2cf

Please sign in to comment.