Skip to content

Commit

Permalink
to_string -> to_owned
Browse files Browse the repository at this point in the history
This is more idiomatic
  • Loading branch information
stepancheg committed Jun 25, 2024
1 parent 65f3f01 commit 87e0b10
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions protobuf-codegen/src/gen/rust_types_values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,17 +214,17 @@ impl RustType {
// default value for type
pub fn default_value(&self, customize: &Customize, const_expr: bool) -> String {
match *self {
RustType::Ref(ref t) if t.is_str() => "\"\"".to_string(),
RustType::Ref(ref t) if t.is_slice().is_some() => "&[]".to_string(),
RustType::Int(..) => "0".to_string(),
RustType::Float(..) => "0.".to_string(),
RustType::Bool => "false".to_string(),
RustType::Vec(..) => EXPR_VEC_NEW.to_string(),
RustType::HashMap(..) => "::std::collections::HashMap::new()".to_string(),
RustType::String => "::std::string::String::new()".to_string(),
RustType::Bytes => "::bytes::Bytes::new()".to_string(),
RustType::Ref(ref t) if t.is_str() => "\"\"".to_owned(),
RustType::Ref(ref t) if t.is_slice().is_some() => "&[]".to_owned(),
RustType::Int(..) => "0".to_owned(),
RustType::Float(..) => "0.".to_owned(),
RustType::Bool => "false".to_owned(),
RustType::Vec(..) => EXPR_VEC_NEW.to_owned(),
RustType::HashMap(..) => "::std::collections::HashMap::new()".to_owned(),
RustType::String => "::std::string::String::new()".to_owned(),
RustType::Bytes => "::bytes::Bytes::new()".to_owned(),
RustType::Chars => format!("{}::Chars::new()", protobuf_crate_path(customize)),
RustType::Option(..) => EXPR_NONE.to_string(),
RustType::Option(..) => EXPR_NONE.to_owned(),
RustType::MessageField(..) => {
format!("{}::MessageField::none()", protobuf_crate_path(customize))
}
Expand Down

0 comments on commit 87e0b10

Please sign in to comment.