Fix unused warnings in Rust Proto

PiperOrigin-RevId: 628973552
pull/16653/head
Protobuf Team Bot 10 months ago committed by Copybara-Service
parent de6aba9f63
commit 1d0028ddda
  1. 1
      rust/BUILD
  2. 2
      rust/cpp.rs
  3. 47
      rust/macros.rs
  4. 1
      rust/shared.rs
  5. 1
      rust/string.rs
  6. 2
      rust/upb.rs

@ -48,7 +48,6 @@ rust_library(
PROTOBUF_SHARED = [
"enum.rs",
"internal.rs",
"macros.rs",
"optional.rs",
"primitive.rs",
"proxied.rs",

@ -10,7 +10,7 @@
use crate::__internal::{Enum, Private};
use crate::{
Map, MapIter, Mut, ProtoStr, Proxied, ProxiedInMapValue, ProxiedInRepeated, Repeated,
RepeatedMut, RepeatedView, SettableValue, View,
RepeatedMut, RepeatedView, View,
};
use core::fmt::Debug;
use paste::paste;

@ -1,47 +0,0 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google LLC. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
//! Runtime-internal macros
/// Defines a `impl SettableValue<$proxied> for SomeType` body that forwards to
/// another implementation.
///
/// # Example
/// ```ignore
/// impl<'a, const N: usize> SettableValue<[u8]> for &'a [u8; N] {
/// // Use the `SettableValue<[u8]>` implementation for `&[u8]`:
/// impl_forwarding_settable_value!([u8], self => &self[..]);
/// }
/// ```
macro_rules! impl_forwarding_settable_value {
($proxied:ty, $self:ident => $self_forwarding_expr:expr) => {
fn set_on<'b>(
$self,
_private: $crate::__internal::Private,
mutator: $crate::Mut<'b, $proxied>,
) where $proxied: 'b {
($self_forwarding_expr).set_on(Private, mutator)
}
fn set_on_absent(
$self,
_private: $crate::__internal::Private,
absent_mutator: <$proxied as $crate::ProxiedWithPresence>::AbsentMutData<'_>,
) -> <$proxied as $crate::ProxiedWithPresence>::PresentMutData<'_> {
($self_forwarding_expr).set_on_absent($crate::__internal::Private, absent_mutator)
}
fn set_on_present(
$self,
_private: $crate::__internal::Private,
present_mutator: <$proxied as $crate::ProxiedWithPresence>::PresentMutData<'_>,
) {
($self_forwarding_expr).set_on_present($crate::__internal::Private, present_mutator)
}
};
}
pub(crate) use impl_forwarding_settable_value;

@ -56,7 +56,6 @@ pub mod __runtime;
#[path = "enum.rs"]
mod r#enum;
mod macros;
mod map;
mod optional;
mod primitive;

@ -13,7 +13,6 @@ use crate::__internal::Private;
use crate::__runtime::{
BytesAbsentMutData, BytesPresentMutData, InnerBytesMut, PtrAndLen, RawMessage,
};
use crate::macros::impl_forwarding_settable_value;
use crate::{
AbsentField, FieldEntry, Mut, MutProxied, MutProxy, Optional, PresentField, Proxied,
ProxiedWithPresence, SettableValue, View, ViewProxy,

@ -10,7 +10,7 @@
use crate::__internal::{Enum, Private};
use crate::{
Map, MapIter, MapMut, MapView, Mut, ProtoStr, Proxied, ProxiedInMapValue, ProxiedInRepeated,
Repeated, RepeatedMut, RepeatedView, SettableValue, View, ViewProxy,
Repeated, RepeatedMut, RepeatedView, View, ViewProxy,
};
use core::fmt::Debug;
use std::alloc::Layout;

Loading…
Cancel
Save