Skip to content

Commit

Permalink
Remove unnecessary cart bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Nov 10, 2021
1 parent 0bd4bb4 commit 0069af4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
12 changes: 6 additions & 6 deletions provider/core/src/data_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ where
) -> <M2::Yokeable as Yokeable<'a>>::Output,
) -> DataPayload<'data, M2>
where
M2: DataMarker<'data, Cart = M::Cart>,
M2: DataMarker<'data>,
{
use DataPayloadInner::*;
match self.inner {
Expand Down Expand Up @@ -598,7 +598,7 @@ where
) -> <M2::Yokeable as Yokeable<'a>>::Output,
) -> DataPayload<'data, M2>
where
M2: DataMarker<'data, Cart = M::Cart>,
M2: DataMarker<'data>,
{
use DataPayloadInner::*;
match &self.inner {
Expand Down Expand Up @@ -690,7 +690,7 @@ where
) -> <M2::Yokeable as Yokeable<'a>>::Output,
) -> DataPayload<'data, M2>
where
M2: DataMarker<'data, Cart = M::Cart>,
M2: DataMarker<'data>,
{
use DataPayloadInner::*;
match self.inner {
Expand Down Expand Up @@ -756,7 +756,7 @@ where
) -> <M2::Yokeable as Yokeable<'a>>::Output,
) -> DataPayload<'data, M2>
where
M2: DataMarker<'data, Cart = M::Cart>,
M2: DataMarker<'data>,
{
use DataPayloadInner::*;
match &self.inner {
Expand Down Expand Up @@ -856,7 +856,7 @@ where
) -> Result<<M2::Yokeable as Yokeable<'a>>::Output, E>,
) -> Result<DataPayload<'data, M2>, E>
where
M2: DataMarker<'data, Cart = M::Cart>,
M2: DataMarker<'data>,
{
use DataPayloadInner::*;
Ok(match self.inner {
Expand Down Expand Up @@ -926,7 +926,7 @@ where
) -> Result<<M2::Yokeable as Yokeable<'a>>::Output, E>,
) -> Result<DataPayload<'data, M2>, E>
where
M2: DataMarker<'data, Cart = M::Cart>,
M2: DataMarker<'data>,
{
use DataPayloadInner::*;
Ok(match &self.inner {
Expand Down
7 changes: 1 addition & 6 deletions provider/core/src/erased.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ pub struct ErasedDataYokeable(Rc<dyn ErasedDataStruct>);
impl<'data, M> crate::dynutil::UpcastDataPayload<'static, M> for ErasedDataStructMarker
where
M: DataMarker<'static>,
M::Cart: Sized,
{
/// Upcast for ErasedDataStruct creates an `Rc<dyn ErasedDataStruct>` from the current inner
/// `Yoke` (i.e., `Rc::from(yoke)`).
Expand Down Expand Up @@ -137,8 +136,6 @@ impl<'data> DataPayload<'static, ErasedDataStructMarker> {
pub fn downcast<M>(self) -> Result<DataPayload<'static, M>, Error>
where
M: DataMarker<'static>,
M::Cart: Sized,
M::Yokeable: ZeroCopyFrom<M::Cart>,
{
use crate::data_provider::DataPayloadInner::*;
match self.inner {
Expand Down Expand Up @@ -183,7 +180,7 @@ impl<'data> DataPayload<'static, ErasedDataStructMarker> {
// None of the downcasts succeeded; return an error.
Err(Error::MismatchedType {
actual: Some(any_rc.type_id()),
generic: Some(TypeId::of::<M::Cart>()),
generic: Some(TypeId::of::<M::Yokeable>()),
})
}
// This is unreachable because an ErasedDataStruct payload can only be constructed as fully owned
Expand Down Expand Up @@ -246,8 +243,6 @@ impl<'data, M> DataProvider<'static, M> for dyn ErasedDataProvider<'data> + 'dat
where
M: DataMarker<'static>,
<M::Yokeable as Yokeable<'static>>::Output: Clone + Any,
M::Yokeable: ZeroCopyFrom<M::Cart>,
M::Cart: Sized,
{
/// Serve [`Sized`] objects from an [`ErasedDataProvider`] via downcasting.
fn load_payload(&self, req: &DataRequest) -> Result<DataResponse<'static, M>, Error> {
Expand Down
2 changes: 1 addition & 1 deletion provider/core/src/inv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use crate::error::Error;
use crate::iter::IterableDataProviderCore;
use crate::prelude::*;
use alloc::boxed::Box;
use alloc::vec::Vec;
use alloc::vec;
use alloc::vec::Vec;

/// A locale-invariant data provider. Sometimes useful for testing. Not intended to be used in
/// production environments.
Expand Down
1 change: 0 additions & 1 deletion provider/core/src/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ impl<'data, M> crate::dynutil::UpcastDataPayload<'data, M> for SerdeSeDataStruct
where
M: DataMarker<'data>,
for<'a> &'a <M::Yokeable as Yokeable<'a>>::Output: serde::Serialize,
M::Cart: IsCovariant<'data>,
{
fn upcast(other: DataPayload<'data, M>) -> DataPayload<'data, SerdeSeDataStructMarker> {
use crate::data_provider::{DataPayloadInner, ErasedCart};
Expand Down

0 comments on commit 0069af4

Please sign in to comment.