Closed
Description
I was trying to do something admittedly a little weird. 1) match foo.into() { }
where foo
is Into<String>
. 2) Declare a const empty string to avoid creating a local temporary to match against (defined in a different module): pub const EMPTY_STRING: String = String::new();
.
The offending code:
pub struct HexByteString(String);
impl HexByteString {
pub fn new<T: Into<String>>(init_value: T) -> Result<HexByteString> {
match init_value.into() {
consts::EMPTY_STRING => Err(Error::EmptyValue(msgs::ERR_EMPTY_VALUE.to_string())),
s @ _ => Ok(HexByteString(s)),
}
}
}