Commit db972be2 authored by jean-airoldie's avatar jean-airoldie Committed by Robert Winslow

[rust] Ran rustfmt against library code (#5389)

parent e304f8c1
This diff is collapsed.
......@@ -34,7 +34,7 @@ pub trait EndianScalar: Sized + PartialEq + Copy + Clone {
/// Macro for implementing a no-op endian conversion. This is used for types
/// that are one byte wide.
macro_rules! impl_endian_scalar_noop {
($ty:ident) => (
($ty:ident) => {
impl EndianScalar for $ty {
#[inline]
fn to_little_endian(self) -> Self {
......@@ -45,7 +45,7 @@ macro_rules! impl_endian_scalar_noop {
self
}
}
)
};
}
/// Macro for implementing an endian conversion using the stdlib `to_le` and
......@@ -53,7 +53,7 @@ macro_rules! impl_endian_scalar_noop {
/// floats, because the `to_le` and `from_le` are not implemented for them in
/// the stdlib.
macro_rules! impl_endian_scalar_stdlib_le_conversion {
($ty:ident) => (
($ty:ident) => {
impl EndianScalar for $ty {
#[inline]
fn to_little_endian(self) -> Self {
......@@ -64,7 +64,7 @@ macro_rules! impl_endian_scalar_stdlib_le_conversion {
Self::from_le(self)
}
}
)
};
}
impl_endian_scalar_noop!(bool);
......@@ -177,4 +177,3 @@ pub fn read_scalar<T: EndianScalar>(s: &[u8]) -> T {
x.from_little_endian()
}
......@@ -39,12 +39,14 @@ mod vtable;
mod vtable_writer;
pub use builder::FlatBufferBuilder;
pub use endian_scalar::{EndianScalar, emplace_scalar, read_scalar, read_scalar_at, byte_swap_f32, byte_swap_f64};
pub use endian_scalar::{
byte_swap_f32, byte_swap_f64, emplace_scalar, read_scalar, read_scalar_at, EndianScalar,
};
pub use follow::{Follow, FollowStart};
pub use primitives::*;
pub use push::Push;
pub use table::{Table, buffer_has_identifier, get_root, get_size_prefixed_root};
pub use vector::{SafeSliceAccess, Vector, follow_cast_ref};
pub use table::{buffer_has_identifier, get_root, get_size_prefixed_root, Table};
pub use vector::{follow_cast_ref, SafeSliceAccess, Vector};
pub use vtable::field_index_to_field_offset;
// TODO(rw): Unify `create_vector` and `create_vector_direct` by using
......
......@@ -274,7 +274,7 @@ impl<'a, T: Follow<'a> + 'a> Follow<'a> for SkipFileIdentifier<T> {
/// EndianScalar, but implementing Follow that way causes a conflict with
/// other impls.
macro_rules! impl_follow_for_endian_scalar {
($ty:ident) => (
($ty:ident) => {
impl<'a> Follow<'a> for $ty {
type Inner = $ty;
#[inline(always)]
......@@ -282,7 +282,7 @@ macro_rules! impl_follow_for_endian_scalar {
read_scalar_at::<$ty>(buf, loc)
}
}
)
};
}
impl_follow_for_endian_scalar!(bool);
......
......@@ -55,7 +55,7 @@ impl PushAlignment {
/// Macro to implement Push for EndianScalar types.
macro_rules! impl_push_for_endian_scalar {
($ty:ident) => (
($ty:ident) => {
impl Push for $ty {
type Output = $ty;
......@@ -63,9 +63,8 @@ macro_rules! impl_push_for_endian_scalar {
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
emplace_scalar::<$ty>(dst, *self);
}
}
)
};
}
impl_push_for_endian_scalar!(bool);
......
......@@ -134,4 +134,3 @@ impl<'a, T: Follow<'a> + 'a> Follow<'a> for Vector<'a, T> {
Vector::new(buf, loc)
}
}
......@@ -34,10 +34,7 @@ impl<'a> PartialEq for VTable<'a> {
impl<'a> VTable<'a> {
pub fn init(buf: &'a [u8], loc: usize) -> Self {
VTable {
buf: buf,
loc: loc,
}
VTable { buf: buf, loc: loc }
}
pub fn num_fields(&self) -> usize {
(self.num_bytes() / SIZE_VOFFSET) - 2
......@@ -72,7 +69,6 @@ impl<'a> VTable<'a> {
}
}
#[allow(dead_code)]
pub fn field_index_to_field_offset(field_id: VOffsetT) -> VOffsetT {
// Should correspond to what end_table() below builds up.
......
......@@ -82,4 +82,3 @@ impl<'a> VTableWriter<'a> {
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment