From 87e0b102ab89c8e1c79688066162c2642a5fbc0c Mon Sep 17 00:00:00 2001 From: Stepan Koltsov Date: Wed, 26 Jun 2024 00:16:09 +0100 Subject: [PATCH] to_string -> to_owned This is more idiomatic --- protobuf-codegen/src/gen/rust_types_values.rs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/protobuf-codegen/src/gen/rust_types_values.rs b/protobuf-codegen/src/gen/rust_types_values.rs index cd67f2b35..c024192be 100644 --- a/protobuf-codegen/src/gen/rust_types_values.rs +++ b/protobuf-codegen/src/gen/rust_types_values.rs @@ -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)) }