mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-09 02:36:09 +00:00
Use Display instead of ToString in Rust generators (#18633)
This commit is contained in:
@@ -23,12 +23,12 @@ pub enum Color {
|
||||
|
||||
}
|
||||
|
||||
impl ToString for Color {
|
||||
fn to_string(&self) -> String {
|
||||
impl std::fmt::Display for Color {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::Red => String::from("RED"),
|
||||
Self::Green => String::from("GREEN"),
|
||||
Self::Blue => String::from("BLUE"),
|
||||
Self::Red => write!(f, "RED"),
|
||||
Self::Green => write!(f, "GREEN"),
|
||||
Self::Blue => write!(f, "BLUE"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user