diff --git a/Cargo.toml b/Cargo.toml index 1cad234834..1ff41955f3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,12 +42,11 @@ arbitrary = { version = "1.0.0", features = ["derive"], optional = true } wasm-bindgen = { version = "0.2", optional = true } js-sys = { version = "0.3", optional = true } # contains FFI bindings for the JS Date API - [target.'cfg(windows)'.dependencies] -windows-targets = { version = "0.48", optional = true } +windows-targets = { version = "0.52", optional = true } [target.'cfg(windows)'.dev-dependencies] -windows-bindgen = { version = "0.51" } +windows-bindgen = { version = "0.52" } [target.'cfg(unix)'.dependencies] iana-time-zone = { version = "0.1.45", optional = true, features = ["fallback"] } @@ -56,9 +55,10 @@ iana-time-zone = { version = "0.1.45", optional = true, features = ["fallback"] android-tzdata = { version = "0.1.1", optional = true } [dev-dependencies] +bincode = { version = "1.3.0" } serde_json = { version = "1" } serde_derive = { version = "1", default-features = false } -bincode = { version = "1.3.0" } +similar-asserts = "1.5" [target.'cfg(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))))'.dev-dependencies] wasm-bindgen-test = "0.3" diff --git a/src/datetime/tests.rs b/src/datetime/tests.rs index 42b014983d..3df11e78d4 100644 --- a/src/datetime/tests.rs +++ b/src/datetime/tests.rs @@ -412,6 +412,7 @@ fn signed_duration_since_autoref() { let dt1 = Utc.with_ymd_and_hms(2014, 5, 6, 7, 8, 9).unwrap(); let dt2 = Utc.with_ymd_and_hms(2014, 3, 4, 5, 6, 7).unwrap(); let diff1 = dt1.signed_duration_since(dt2); // Copy/consume + #[allow(clippy::needless_borrows_for_generic_args)] let diff2 = dt2.signed_duration_since(&dt1); // Take by reference assert_eq!(diff1, -diff2); diff --git a/src/offset/local/win_bindings.rs b/src/offset/local/win_bindings.rs index 292c951414..592726c732 100644 --- a/src/offset/local/win_bindings.rs +++ b/src/offset/local/win_bindings.rs @@ -1,4 +1,4 @@ -// Bindings generated by `windows-bindgen` 0.51.1 +// Bindings generated by `windows-bindgen` 0.52.0 #![allow(non_snake_case, non_upper_case_globals, non_camel_case_types, dead_code, clippy::all)] ::windows_targets::link!("kernel32.dll" "system" fn SystemTimeToFileTime(lpsystemtime : *const SYSTEMTIME, lpfiletime : *mut FILETIME) -> BOOL); diff --git a/tests/win_bindings.rs b/tests/win_bindings.rs index bfb110c38e..6995f6895f 100644 --- a/tests/win_bindings.rs +++ b/tests/win_bindings.rs @@ -1,5 +1,6 @@ #![cfg(all(windows, feature = "clock", feature = "std"))] +use similar_asserts::assert_eq; use std::fs; use windows_bindgen::bindgen; @@ -7,7 +8,7 @@ use windows_bindgen::bindgen; fn gen_bindings() { let input = "src/offset/local/win_bindings.txt"; let output = "src/offset/local/win_bindings.rs"; - let existing = fs::read_to_string(output).unwrap(); + let existing = fs::read_to_string(output).unwrap().replace("\r\n", "\n"); let log = bindgen(["--etc", input]).unwrap(); eprintln!("{}", log); @@ -15,8 +16,6 @@ fn gen_bindings() { // Check the output is the same as before. // Depending on the git configuration the file may have been checked out with `\r\n` newlines or // with `\n`. Compare line-by-line to ignore this difference. - let new = fs::read_to_string(output).unwrap(); - if !new.lines().eq(existing.lines()) { - panic!("generated file `{}` is changed.", output); - } + let new = fs::read_to_string(output).unwrap().replace("\r\n", "\n"); + assert_eq!(new, existing); }