From ae07909a022ca47bf23921abbab2c6e8daca986a Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sat, 15 Oct 2022 10:04:37 -0400 Subject: [PATCH] Fix deserialize impl for RelayId. We need to handle String, not just str, since some deserializers have to handle escapes and generate new strings. Found while writing tests; fixes #605. --- crates/tor-linkspec/src/ids.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/tor-linkspec/src/ids.rs b/crates/tor-linkspec/src/ids.rs index 0b1fd23da..01d00e3f6 100644 --- a/crates/tor-linkspec/src/ids.rs +++ b/crates/tor-linkspec/src/ids.rs @@ -284,7 +284,7 @@ impl<'de> serde::Deserialize<'de> for RelayId { // TODO(nickm): maybe allow bytes when dealing with non-human-readable // formats. use serde::de::Error as _; - let s = <&str as serde::Deserialize>::deserialize(deserializer)?; + let s = as serde::Deserialize>::deserialize(deserializer)?; s.parse() .map_err(|e: RelayIdError| D::Error::custom(e.to_string())) }