From 5d283755e3cfdf8c040776fe598f253d1a120157 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 2 Dec 2023 09:19:15 -0800 Subject: [PATCH] Fix `Option<&str> == Option<&String>` w/ rust_decimal/rkyv feat (#11205) Without this change, projects which depend on both nu-command and rust_decimal's "rkyv" feature cause nu-command to fail to compile. ```toml [dependencies] nu-command = { path = "../nushell/crates/nu-command" } rust_decimal = { version = "1", features = ["rkyv"] } ``` ```console error[E0277]: can't compare `std::option::Option<&str>` with `std::option::Option<&std::string::String>` --> nushell/crates/nu-command/src/filters/join.rs:367:35 | 367 | let k_shared = shared_key == Some(k); | ^^ no implementation for `std::option::Option<&str> == std::option::Option<&std::string::String>` | = help: the trait `PartialEq>` is not implemented for `std::option::Option<&str>` = help: the following other types implement trait `PartialEq`: > as PartialEq>> as PartialEq> as PartialEq>> For more information about this error, try `rustc --explain E0277`. warning: `nu-command` (lib) generated 1 warning error: could not compile `nu-command` (lib) due to previous error; 1 warning emitted ``` --- crates/nu-command/src/filters/join.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/nu-command/src/filters/join.rs b/crates/nu-command/src/filters/join.rs index 4156009664..08f7d413e1 100644 --- a/crates/nu-command/src/filters/join.rs +++ b/crates/nu-command/src/filters/join.rs @@ -364,7 +364,7 @@ fn merge_records(left: &Record, right: &Record, shared_key: Option<&str>) -> Rec for (k, v) in right { let k_seen = seen.contains(k); - let k_shared = shared_key == Some(k); + let k_shared = shared_key == Some(k.as_str()); // Do not output shared join key twice if !(k_seen && k_shared) { record.push(