reduce leading underscores
All checks were successful
buildbot/cargo fmt (1.72) Build done.
buildbot/cargo doc (1.72) Build done.
buildbot/cargo clippy (1.72) Build done.
buildbot/cargo test (1.65) Build done.
buildbot/cargo clippy (1.65) Build done.

This commit is contained in:
AF 2023-09-01 00:06:23 +00:00
parent 5cccad7022
commit c32c83de4f
10 changed files with 44 additions and 45 deletions

View File

@ -56,7 +56,7 @@ pub trait Atomic: AtomicModeParse {
fn a_extend(self, tail: &[u8]) -> AParseResult<Self>; fn a_extend(self, tail: &[u8]) -> AParseResult<Self>;
} }
fn _parse_slice<A: Atomic>(slice: &[u8]) -> AParseResult<A> { fn parse_slice<A: Atomic>(slice: &[u8]) -> AParseResult<A> {
let mut deserializer = SliceDeserializer::from(slice); let mut deserializer = SliceDeserializer::from(slice);
let atomic = A::a_deserialize(&mut deserializer)?; let atomic = A::a_deserialize(&mut deserializer)?;
let tail = deserializer.read_all(); let tail = deserializer.read_all();
@ -73,7 +73,7 @@ pub trait AtomicExt: Atomic {
/// ///
/// [`FactoryExt::parse_slice`]: crate::rcore::FactoryExt::parse_slice /// [`FactoryExt::parse_slice`]: crate::rcore::FactoryExt::parse_slice
fn parse_slice(slice: &[u8]) -> AParseResult<Self> { fn parse_slice(slice: &[u8]) -> AParseResult<Self> {
_parse_slice(slice) parse_slice(slice)
} }
} }

View File

@ -6,59 +6,59 @@ type Frwa<'a, A, E0, E1, Fallible> =
type Wwa<'a, A, E0, E1, Fallible> = WrapE<'a, WrapE<'a, A, E0, Fallible>, E1, Fallible>; type Wwa<'a, A, E0, E1, Fallible> = WrapE<'a, WrapE<'a, A, E0, Fallible>, E1, Fallible>;
trait SpeculativeFailImpl<'a>: MonadFailAny<'a> { trait SpeculativeFailImpl<'a>: MonadFailAny<'a> {
fn _speculative_a_wb<A: 'a + Send, B: 'a + Send, E0: 'a + Send, E1: 'a + Send>( fn speculative_a_wb<A: 'a + Send, B: 'a + Send, E0: 'a + Send, E1: 'a + Send>(
a: A, a: A,
wb: WrapE<'a, B, E0, Self>, wb: WrapE<'a, B, E0, Self>,
) -> WrapE<'a, (A, B), Result<E0, E1>, Self> { ) -> WrapE<'a, (A, B), Result<E0, E1>, Self> {
Self::map_err(<Self::W<E0> as Functor>::fmap(wb, |b| (a, b)), Ok) Self::map_err(<Self::W<E0> as Functor>::fmap(wb, |b| (a, b)), Ok)
} }
fn _speculative_ra_wb<A: 'a + Send, B: 'a + Send, E0: 'a + Send, E1: 'a + Send>( fn speculative_ra_wb<A: 'a + Send, B: 'a + Send, E0: 'a + Send, E1: 'a + Send>(
ra: Result<A, E0>, ra: Result<A, E0>,
wb: WrapE<'a, B, E0, Self>, wb: WrapE<'a, B, E0, Self>,
) -> WrapE<'a, (A, B), Result<E0, E1>, Self> { ) -> WrapE<'a, (A, B), Result<E0, E1>, Self> {
match ra { match ra {
Ok(a) => Self::_speculative_a_wb(a, wb), Ok(a) => Self::speculative_a_wb(a, wb),
Err(e0) => Self::fail(Ok(e0)), Err(e0) => Self::fail(Ok(e0)),
} }
} }
fn _speculative_ra_rwb<A: 'a + Send, B: 'a + Send, E0: 'a + Send, E1: 'a + Send>( fn speculative_ra_rwb<A: 'a + Send, B: 'a + Send, E0: 'a + Send, E1: 'a + Send>(
ra: Result<A, E0>, ra: Result<A, E0>,
rwb: Result<WrapE<'a, B, E0, Self>, E1>, rwb: Result<WrapE<'a, B, E0, Self>, E1>,
) -> WrapE<'a, (A, B), Result<E0, E1>, Self> { ) -> WrapE<'a, (A, B), Result<E0, E1>, Self> {
match rwb { match rwb {
Ok(wb) => Self::_speculative_ra_wb(ra, wb), Ok(wb) => Self::speculative_ra_wb(ra, wb),
Err(e1) => Self::fail(Err(e1)), Err(e1) => Self::fail(Err(e1)),
} }
} }
fn _speculative_ra_frwb<A: 'a + Send, B: 'a + Send, E0: 'a + Send, E1: 'a + Send>( fn speculative_ra_frwb<A: 'a + Send, B: 'a + Send, E0: 'a + Send, E1: 'a + Send>(
ra: Result<A, E0>, ra: Result<A, E0>,
frwb: Frwa<'a, B, E0, E1, Self>, frwb: Frwa<'a, B, E0, E1, Self>,
) -> WrapE<'a, (A, B), Result<E0, E1>, Self> { ) -> WrapE<'a, (A, B), Result<E0, E1>, Self> {
Self::stuff(<Self::T as Monad>::bind(frwb, |rwb| { Self::stuff(<Self::T as Monad>::bind(frwb, |rwb| {
Self::unstuff(Self::_speculative_ra_rwb(ra, rwb)) Self::unstuff(Self::speculative_ra_rwb(ra, rwb))
})) }))
} }
fn _speculative_fra_wb<A: 'a + Send, B: 'a + Send, E0: 'a + Send>( fn speculative_fra_wb<A: 'a + Send, B: 'a + Send, E0: 'a + Send>(
fra: Wrap<'a, Result<A, E0>, Self::T>, fra: Wrap<'a, Result<A, E0>, Self::T>,
wb: WrapE<'a, B, E0, Self>, wb: WrapE<'a, B, E0, Self>,
) -> WrapE<'a, (A, B), E0, Self> { ) -> WrapE<'a, (A, B), E0, Self> {
<Self::W<E0> as ApplicativeTuple>::tuple((Self::stuff(fra), wb)) <Self::W<E0> as ApplicativeTuple>::tuple((Self::stuff(fra), wb))
} }
fn _speculative_wa_frwb<A: 'a + Send, B: 'a + Send, E0: 'a + Send, E1: 'a + Send>( fn speculative_wa_frwb<A: 'a + Send, B: 'a + Send, E0: 'a + Send, E1: 'a + Send>(
wa: WrapE<'a, A, E0, Self>, wa: WrapE<'a, A, E0, Self>,
frwb: Frwa<'a, B, E0, E1, Self>, frwb: Frwa<'a, B, E0, E1, Self>,
) -> WrapE<'a, (A, B), Result<E0, E1>, Self> { ) -> WrapE<'a, (A, B), Result<E0, E1>, Self> {
Self::stuff(<<Self as MonadFailAny>::T as Monad>::join( Self::stuff(<<Self as MonadFailAny>::T as Monad>::join(
<<Self as MonadFailAny>::T as Functor>::fmap( <<Self as MonadFailAny>::T as Functor>::fmap(
Self::T::select_map(Self::unstuff(wa), frwb, |selected| match selected { Self::T::select_map(Self::unstuff(wa), frwb, |selected| match selected {
Selected::A(ra, frwb) => Self::_speculative_ra_frwb(ra, frwb), Selected::A(ra, frwb) => Self::speculative_ra_frwb(ra, frwb),
Selected::B(fra, Ok(wb)) => { Selected::B(fra, Ok(wb)) => {
Self::map_err(Self::_speculative_fra_wb(fra, wb), Ok) Self::map_err(Self::speculative_fra_wb(fra, wb), Ok)
} }
Selected::B(_, Err(e1)) => Self::fail(Err(e1)), Selected::B(_, Err(e1)) => Self::fail(Err(e1)),
}), }),
@ -67,17 +67,16 @@ trait SpeculativeFailImpl<'a>: MonadFailAny<'a> {
)) ))
} }
fn _speculative_frwa_wb<A: 'a + Send, B: 'a + Send, E0: 'a + Send, E1: 'a + Send>( fn speculative_frwa_wb<A: 'a + Send, B: 'a + Send, E0: 'a + Send, E1: 'a + Send>(
frwa: Frwa<'a, A, E0, E1, Self>, frwa: Frwa<'a, A, E0, E1, Self>,
wb: WrapE<'a, B, E0, Self>, wb: WrapE<'a, B, E0, Self>,
) -> WrapE<'a, (A, B), Result<E0, E1>, Self> { ) -> WrapE<'a, (A, B), Result<E0, E1>, Self> {
<Self::W<Result<E0, E1>> as Functor>::fmap( <Self::W<Result<E0, E1>> as Functor>::fmap(Self::speculative_wa_frwb(wb, frwa), |(b, a)| {
Self::_speculative_wa_frwb(wb, frwa), (a, b)
|(b, a)| (a, b), })
)
} }
fn _speculative<A: 'a + Send, B: 'a + Send, E0: 'a + Send, E1: 'a + Send>( fn speculative_impl<A: 'a + Send, B: 'a + Send, E0: 'a + Send, E1: 'a + Send>(
wwa: Wwa<'a, A, E0, E1, Self>, wwa: Wwa<'a, A, E0, E1, Self>,
wwb: Wwa<'a, B, E0, E1, Self>, wwb: Wwa<'a, B, E0, E1, Self>,
) -> WrapE<'a, (A, B), Result<E0, E1>, Self> { ) -> WrapE<'a, (A, B), Result<E0, E1>, Self> {
@ -86,9 +85,9 @@ trait SpeculativeFailImpl<'a>: MonadFailAny<'a> {
Self::unstuff(wwa), Self::unstuff(wwa),
Self::unstuff(wwb), Self::unstuff(wwb),
|selected| match selected { |selected| match selected {
Selected::A(Ok(wa), frwb) => Self::_speculative_wa_frwb(wa, frwb), Selected::A(Ok(wa), frwb) => Self::speculative_wa_frwb(wa, frwb),
Selected::A(Err(e1), _) => Self::fail(Err(e1)), Selected::A(Err(e1), _) => Self::fail(Err(e1)),
Selected::B(frwa, Ok(wb)) => Self::_speculative_frwa_wb(frwa, wb), Selected::B(frwa, Ok(wb)) => Self::speculative_frwa_wb(frwa, wb),
Selected::B(_, Err(e1)) => Self::fail(Err(e1)), Selected::B(_, Err(e1)) => Self::fail(Err(e1)),
}, },
), ),
@ -102,7 +101,7 @@ pub trait SpeculativeFail<'a>: MonadFailAny<'a> {
wwa: Wwa<'a, A, E0, E1, Self>, wwa: Wwa<'a, A, E0, E1, Self>,
wwb: Wwa<'a, B, E0, E1, Self>, wwb: Wwa<'a, B, E0, E1, Self>,
) -> WrapE<'a, (A, B), Result<E0, E1>, Self> { ) -> WrapE<'a, (A, B), Result<E0, E1>, Self> {
Self::_speculative(wwa, wwb) Self::speculative_impl(wwa, wwb)
} }
} }

View File

@ -17,7 +17,7 @@ pub fn bind<'a, T: Monad<'a>, A: 'a + Send, B: 'a + Send>(
} }
pub trait ApplicativeLA2ViaSeq<'a>: ApplicativeSeq<'a> { pub trait ApplicativeLA2ViaSeq<'a>: ApplicativeSeq<'a> {
fn _la2_via_seq<A: 'a + Send, B: 'a + Send, C: 'a + Send>( fn la2_via_seq<A: 'a + Send, B: 'a + Send, C: 'a + Send>(
f: impl 'a + Send + FnOnce(A, B) -> C, f: impl 'a + Send + FnOnce(A, B) -> C,
fa: Self::F<A>, fa: Self::F<A>,
fb: Self::F<B>, fb: Self::F<B>,
@ -29,7 +29,7 @@ pub trait ApplicativeLA2ViaSeq<'a>: ApplicativeSeq<'a> {
impl<'a, T: ApplicativeSeq<'a>> ApplicativeLA2ViaSeq<'a> for T {} impl<'a, T: ApplicativeSeq<'a>> ApplicativeLA2ViaSeq<'a> for T {}
pub trait ApplicativeSeqViaLA2<'a>: ApplicativeLA2<'a> { pub trait ApplicativeSeqViaLA2<'a>: ApplicativeLA2<'a> {
fn _seq_via_la2<A: 'a + Send, B: 'a + Send>( fn seq_via_la2<A: 'a + Send, B: 'a + Send>(
ff: Self::F<impl 'a + Send + FnOnce(A) -> B>, ff: Self::F<impl 'a + Send + FnOnce(A) -> B>,
fa: Self::F<A>, fa: Self::F<A>,
) -> Self::F<B> { ) -> Self::F<B> {
@ -40,7 +40,7 @@ pub trait ApplicativeSeqViaLA2<'a>: ApplicativeLA2<'a> {
impl<'a, T: ApplicativeLA2<'a>> ApplicativeSeqViaLA2<'a> for T {} impl<'a, T: ApplicativeLA2<'a>> ApplicativeSeqViaLA2<'a> for T {}
pub trait ApplicativeTupleViaLA2<'a>: ApplicativeLA2<'a> { pub trait ApplicativeTupleViaLA2<'a>: ApplicativeLA2<'a> {
fn _tuple_via_la2<A: 'a + Send, B: 'a + Send>( fn tuple_via_la2<A: 'a + Send, B: 'a + Send>(
(fa, fb): (Self::F<A>, Self::F<B>), (fa, fb): (Self::F<A>, Self::F<B>),
) -> Self::F<(A, B)> { ) -> Self::F<(A, B)> {
Self::la2(fa, fb, |a, b| (a, b)) Self::la2(fa, fb, |a, b| (a, b))

View File

@ -59,7 +59,7 @@ impl Atom for Temp {
} }
impl<'a> EvalTree<'a> { impl<'a> EvalTree<'a> {
fn _next_composite(mut self: Box<Self>, other: Box<Self>) -> Self { fn next_composite(mut self: Box<Self>, other: Box<Self>) -> Self {
match *self { match *self {
Self::Atom(f) => match f.next() { Self::Atom(f) => match f.next() {
Some(newleft) => { Some(newleft) => {
@ -78,7 +78,7 @@ impl<'a> EvalTree<'a> {
fn next(self) -> Oet<'a> { fn next(self) -> Oet<'a> {
match self { match self {
Self::Atom(f) => f.next(), Self::Atom(f) => f.next(),
Self::Composite(etl, etr) => Some(etl._next_composite(etr)), Self::Composite(etl, etr) => Some(etl.next_composite(etr)),
} }
} }
} }
@ -239,13 +239,13 @@ impl<'a> ApplicativeLA2<'a> for StacklessInstance {
fb: Self::F<B>, fb: Self::F<B>,
f: impl 'a + Send + FnOnce(A, B) -> C, f: impl 'a + Send + FnOnce(A, B) -> C,
) -> Self::F<C> { ) -> Self::F<C> {
Self::_la2_via_seq(f, fa, fb) Self::la2_via_seq(f, fa, fb)
} }
} }
impl<'a> ApplicativeTuple<'a> for StacklessInstance { impl<'a> ApplicativeTuple<'a> for StacklessInstance {
fn tuple<A: 'a + Send, B: 'a + Send>((fa, fb): (Self::F<A>, Self::F<B>)) -> Self::F<(A, B)> { fn tuple<A: 'a + Send, B: 'a + Send>((fa, fb): (Self::F<A>, Self::F<B>)) -> Self::F<(A, B)> {
Self::_tuple_via_la2((fa, fb)) Self::tuple_via_la2((fa, fb))
} }
} }

View File

@ -58,7 +58,7 @@ pub(super) trait InliningAddresses<E>: Stream {
impl<E, D: ?Sized + Stream> InliningAddresses<E> for D {} impl<E, D: ?Sized + Stream> InliningAddresses<E> for D {}
fn _parse_slice<'a, Ctx: Context<'a>, F: FactoryParse<'a, Ctx>>( fn parse_slice<'a, Ctx: Context<'a>, F: FactoryParse<'a, Ctx>>(
factory: &F, factory: &F,
slice: &[u8], slice: &[u8],
resolver: &Arc<dyn Resolver<'a, Ctx>>, resolver: &Arc<dyn Resolver<'a, Ctx>>,
@ -83,7 +83,7 @@ impl<'a, Ctx: Context<'a>, F: FactoryParse<'a, Ctx>> FactoryExt<'a, Ctx> for F {
slice: &[u8], slice: &[u8],
resolver: &Arc<dyn Resolver<'a, Ctx>>, resolver: &Arc<dyn Resolver<'a, Ctx>>,
) -> ParseResult<'a, Self> { ) -> ParseResult<'a, Self> {
_parse_slice::<Ctx, _>(self, slice, resolver) parse_slice::<Ctx, _>(self, slice, resolver)
} }
} }

View File

@ -24,7 +24,7 @@ struct ResolverOrigin<'a, Ctx: Context<'a>, F: FactoryBase<'a>> {
r_resolver: Arc<dyn Resolver<'a, Ctx>>, r_resolver: Arc<dyn Resolver<'a, Ctx>>,
} }
fn _resolve_origin<'a, Ctx: Context<'a>, F: FactoryParse<'a, Ctx>>( fn resolve_origin<'a, Ctx: Context<'a>, F: FactoryParse<'a, Ctx>>(
origin: Arc<ResolverOrigin<'a, Ctx, F>>, origin: Arc<ResolverOrigin<'a, Ctx, F>>,
) -> Resolution<'a, Ctx, F::Mtbl> { ) -> Resolution<'a, Ctx, F::Mtbl> {
origin origin
@ -51,7 +51,7 @@ impl<'a, Ctx: Context<'a>, F: FactoryBase<'a>> Origin<'a, Ctx> for ResolverOrigi
where where
F: FactoryParse<'a, Ctx>, F: FactoryParse<'a, Ctx>,
{ {
_resolve_origin(self) resolve_origin(self)
} }
fn resolve_bytes(self: Arc<Self>) -> HashResolution<'a, Ctx> { fn resolve_bytes(self: Arc<Self>) -> HashResolution<'a, Ctx> {

View File

@ -87,7 +87,7 @@ impl<'a, Ctx: CastCtx<'a>> CastResolver<'a, Ctx> {
Arc::new(Self { points }) Arc::new(Self { points })
} }
fn _get_point( fn get_point_impl(
&self, &self,
index: usize, index: usize,
) -> Result<&Point<'a, Ctx, TypelessMentionable<'a, Ctx>>, CastError<'a>> { ) -> Result<&Point<'a, Ctx, TypelessMentionable<'a, Ctx>>, CastError<'a>> {
@ -100,7 +100,7 @@ impl<'a, Ctx: CastCtx<'a>> CastResolver<'a, Ctx> {
} }
} }
fn _validate_point( fn validate_point(
&self, &self,
point: &Point<'a, Ctx, TypelessMentionable<'a, Ctx>>, point: &Point<'a, Ctx, TypelessMentionable<'a, Ctx>>,
address: Address, address: Address,
@ -120,8 +120,8 @@ impl<'a, Ctx: CastCtx<'a>> CastResolver<'a, Ctx> {
&self, &self,
address: Address, address: Address,
) -> Result<&Point<'a, Ctx, TypelessMentionable<'a, Ctx>>, CastError<'a>> { ) -> Result<&Point<'a, Ctx, TypelessMentionable<'a, Ctx>>, CastError<'a>> {
let point = self._get_point(address.index)?; let point = self.get_point_impl(address.index)?;
self._validate_point(point, address)?; self.validate_point(point, address)?;
Ok(point) Ok(point)
} }
} }

View File

@ -178,30 +178,30 @@ impl<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx> + FixedSizeObject<'a, Ctx>>
/// whether some other type (for example, a generic parameter type) /// whether some other type (for example, a generic parameter type)
/// is fixed-size or not. /// is fixed-size or not.
pub trait AlwaysFixedSize { pub trait AlwaysFixedSize {
fn _size(&self) -> usize; fn asize(&self) -> usize;
} }
impl<'a, Ctx: Context<'a>, F: AlwaysFixedSize + InliningFactory<'a, Ctx>> FixedSizeFactory<'a, Ctx> impl<'a, Ctx: Context<'a>, F: AlwaysFixedSize + InliningFactory<'a, Ctx>> FixedSizeFactory<'a, Ctx>
for F for F
{ {
fn size(&self) -> usize { fn size(&self) -> usize {
self._size() self.asize()
} }
} }
/// Compile-time analogue of [`AlwaysFixedSize`]. /// Compile-time analogue of [`AlwaysFixedSize`].
pub trait AlwaysConstSize { pub trait AlwaysConstSize {
const _SIZE: usize; const ASIZE: usize;
} }
impl<F: AlwaysConstSize> AlwaysFixedSize for F { impl<F: AlwaysConstSize> AlwaysFixedSize for F {
fn _size(&self) -> usize { fn asize(&self) -> usize {
Self::_SIZE Self::ASIZE
} }
} }
impl<'a, Ctx: Context<'a>, F: AlwaysConstSize + InliningFactory<'a, Ctx>> ConstSizeFactory<'a, Ctx> impl<'a, Ctx: Context<'a>, F: AlwaysConstSize + InliningFactory<'a, Ctx>> ConstSizeFactory<'a, Ctx>
for F for F
{ {
const SIZE: usize = Self::_SIZE; const SIZE: usize = Self::ASIZE;
} }

View File

@ -147,7 +147,7 @@ impl<'a, Ctx: Context<'a>, F: FactoryBase<'a>> CInliningFactory<'a, Ctx>
} }
impl<Ctx, F> AlwaysConstSize for NullableFactory<Ctx, F> { impl<Ctx, F> AlwaysConstSize for NullableFactory<Ctx, F> {
const _SIZE: usize = HASH_SIZE; const ASIZE: usize = HASH_SIZE;
} }
impl<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx>> From<Arc<A>> for Nullable<'a, Ctx, A> { impl<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx>> From<Arc<A>> for Nullable<'a, Ctx, A> {

View File

@ -107,5 +107,5 @@ impl<'a, Ctx: Context<'a>, F: FactoryBase<'a>> CInliningFactory<'a, Ctx> for Poi
} }
impl<Ctx, F> AlwaysConstSize for PointFactory<Ctx, F> { impl<Ctx, F> AlwaysConstSize for PointFactory<Ctx, F> {
const _SIZE: usize = HASH_SIZE; const ASIZE: usize = HASH_SIZE;
} }