I'm trying to implement a simple calculator Lexer(just trying, dunno how I'm gonna parse it).
While doing it, the borrow checker is boring me... a lot. In the code below, it complains about something like "creating tempory value", when I created nothing, I'm just using native code. ```rs
let value = match self {
Sign::PlusSign => "+",
Sign::MinusSign => "-",
Sign::MultiplicationSign => "*",
Sign::DivisionSign => "/",
Sign::Number(value) => value.to_string().as_str(),
};
String::from(value)
I solved that by calling `String::from` in every match, but I don't understand why it doesn't work. What I solved with:rs
let value = match self {
Sign::PlusSign => String::from("+"),
Sign::MinusSign => String::from("-"),
Sign::MultiplicationSign => String::from("*"),
Sign::DivisionSign => String::from("/"),
Sign::Number(value) => value.to_string(),
};
value
``` PS: Sign::Number holds an i32