Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
Fix issue #39.
Browse files Browse the repository at this point in the history
When looking for the workspace root, the match:

```rust
 if let JsonValue::String(s) = &metadata()?["workspace_root"]
```

was not succeding as the value was actually `JsonValue::Short(...)`,
an alternative string representation.

Switch to calling `JsonValue`'s `as_str()` method and matching on
the result, which should work in both cases.
  • Loading branch information
jugglerchris authored and davidlattimore committed Dec 16, 2019
1 parent b14bce8 commit cd12022
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/bin/cargo-rerast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ fn cargo_rerast() -> Result<(), Error> {
}
if let Some(crate_root) = matches.value_of("crate_root") {
std::env::set_current_dir(crate_root)?;
} else if let JsonValue::String(s) = &metadata()?["workspace_root"] {
std::env::set_current_dir(s)?
} else if let Some(s) = &metadata()?["workspace_root"].as_str() {
std::env::set_current_dir(s)?;
}
let mut maybe_compiler_invocation_infos = None;
let rules = if let Some(replacement) = matches.value_of("replace_with") {
Expand Down

0 comments on commit cd12022

Please sign in to comment.