diff --git a/src/google/protobuf/compiler/rust/accessors/singular_string.cc b/src/google/protobuf/compiler/rust/accessors/singular_string.cc index cff20e0b444c8..f3ae1e2f491a6 100644 --- a/src/google/protobuf/compiler/rust/accessors/singular_string.cc +++ b/src/google/protobuf/compiler/rust/accessors/singular_string.cc @@ -52,14 +52,12 @@ void SingularString::InMsgImpl(Context field) const { {"transform_view", transform_view}}, R"rs( pub fn $field$_opt(&self) -> $pb$::Optional<&$proxied_type$> { - unsafe { - let view = $getter_thunk$(self.inner.msg).as_ref(); + let view = unsafe { $getter_thunk$(self.inner.msg).as_ref() }; $pb$::Optional::new( $transform_view$ , - $hazzer_thunk$(self.inner.msg) + unsafe { $hazzer_thunk$(self.inner.msg) } ) } - } )rs"); }}, {"field_mutator_getter",