Fix error message for config.get deserialization error

The error message for a deserialization failure was missing a call to
`format!`.
This commit is contained in:
Eric Huss 2025-10-25 16:46:51 -07:00
parent 08d9fddfc9
commit adcbd117da

View file

@ -204,7 +204,7 @@ impl Config {
value value
.clone() .clone()
.try_into() .try_into()
.with_context(|| "Failed to deserialize `{name}`") .with_context(|| format!("Failed to deserialize `{name}`"))
}) })
.transpose() .transpose()
} }
@ -1156,6 +1156,9 @@ mod tests {
"#; "#;
let cfg = Config::from_str(src).unwrap(); let cfg = Config::from_str(src).unwrap();
let err = cfg.get::<String>("preprocessor.foo.x").unwrap_err(); let err = cfg.get::<String>("preprocessor.foo.x").unwrap_err();
assert_eq!(err.to_string(), "Failed to deserialize `{name}`"); assert_eq!(
err.to_string(),
"Failed to deserialize `preprocessor.foo.x`"
);
} }
} }