Skip to content

Commit

Permalink
Bump similar_asserts to 1.6
Browse files Browse the repository at this point in the history
This allows us to remove a call to `String::leak` as they relaxed the
life time requirements on the one method we use.
  • Loading branch information
weiznich committed Sep 19, 2024
1 parent f7e9819 commit 325ffc5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion diesel_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ syn = { version = "2", features = ["visit"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3.10", features = ["env-filter"] }
thiserror = "1.0.10"
similar-asserts = "1.5.0"
similar-asserts = "1.6.0"

[dependencies.diesel]
version = "~2.2.0"
Expand Down
6 changes: 2 additions & 4 deletions diesel_cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,11 @@ fn regenerate_schema_if_file_specified(matches: &ArgMatches) -> Result<(), crate
.map_err(|e| crate::errors::Error::IoError(e, Some(path.to_owned())))?;

if schema.lines().ne(old_buf.lines()) {
// it's fine to leak here, we will
// exit the application anyway soon
let label = path.file_name().expect("We have a file name here");
let label = label.to_string_lossy().into_owned().leak();
let label = label.to_string_lossy();
println!(
"{}",
SimpleDiff::from_str(&old_buf, &schema, label, "new schema")
SimpleDiff::from_str(&old_buf, &schema, &label, "new schema")
);
return Err(crate::errors::Error::SchemaWouldChange(
path.display().to_string(),
Expand Down

0 comments on commit 325ffc5

Please sign in to comment.