Skip to content

Commit

Permalink
Updates the GAT syntax
Browse files Browse the repository at this point in the history
As per rust-lang/rust#89122, GATs no longer use the `type Typename<'a> where Self: 'a = ... ` syntax rather they move the where to the end.

Signed-off-by: Arjo Chakravarty <arjo@openrobotics.org>
  • Loading branch information
arjo129 committed Nov 10, 2022
1 parent f241333 commit 308e512
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion mapf/src/directed/simple.rs
Expand Up @@ -81,7 +81,7 @@ impl<V: std::fmt::Debug + Clone> crate::Graph for SimpleGraph<V> {
type Vertex = V;
type Edge = (usize, usize);

type EdgeIter<'a> where Self: 'a = impl Iterator<Item=(usize, usize)> + 'a;
type EdgeIter<'a> = impl Iterator<Item=(usize, usize)> + 'a where Self: 'a;

fn vertex (&self, key: usize) -> Option<V> {
self.vertices.get(key).cloned()
Expand Down
4 changes: 2 additions & 2 deletions mapf/src/expander/chain.rs
Expand Up @@ -43,7 +43,7 @@ impl<E: Expander, C: Expander<Node=E::Node>> Expander for Chain<E, C> {

impl<E: Targeted<G>, C: Targeted<G, Node=E::Node>, G: Goal<E::Node>> Targeted<G> for Chain<E, C> {
type TargetedError = ChainErr<E::TargetedError, C::TargetedError>;
type TargetedExpansion<'a> where Self: 'a, G: 'a = impl Iterator<Item=Result<Arc<Self::Node>, Self::TargetedError>> + 'a;
type TargetedExpansion<'a> = impl Iterator<Item=Result<Arc<Self::Node>, Self::TargetedError>> + 'a where Self: 'a, G: 'a;

fn expand<'a>(
&'a self,
Expand All @@ -62,7 +62,7 @@ where
G: Goal<E::Node>,
{
type InitTargetedError = E::InitTargetedError;
type InitialTargetedNodes<'a> where Self: 'a, S: 'a, G: 'a = E::InitialTargetedNodes<'a>;
type InitialTargetedNodes<'a> = E::InitialTargetedNodes<'a> where Self: 'a, S: 'a, G: 'a;

fn start<'a>(
&'a self,
Expand Down
2 changes: 1 addition & 1 deletion mapf/src/expander/closure.rs
Expand Up @@ -59,7 +59,7 @@ where
F: Fn(&Arc<N>, &G) -> Exp
{
type TargetedError = Err;
type TargetedExpansion<'a> where Self: 'a = Exp;
type TargetedExpansion<'a> = Exp where Self: 'a;

fn expand<'a>(
&'a self,
Expand Down
4 changes: 2 additions & 2 deletions mapf/src/expander/constrain.rs
Expand Up @@ -57,7 +57,7 @@ impl<E: Expander, C> Expander for Constrain<E, C> {

impl<E: Targeted<G>, C: TargetedConstraint<E::Node, G>, G: Goal<E::Node>> Targeted<G> for Constrain<E, C> {
type TargetedError = ConstrainErr<E::TargetedError, C::ConstraintError>;
type TargetedExpansion<'a> where Self: 'a, G: 'a = impl Iterator<Item=Result<Arc<Self::Node>, Self::TargetedError>> + 'a;
type TargetedExpansion<'a> = impl Iterator<Item=Result<Arc<Self::Node>, Self::TargetedError>> + 'a where Self: 'a, G: 'a ;

fn expand<'a>(
&'a self,
Expand All @@ -77,7 +77,7 @@ where
G: Goal<E::Node>,
{
type InitTargetedError = ConstrainErr<E::InitTargetedError, C::ConstraintError>;
type InitialTargetedNodes<'a> where Self: 'a, S: 'a, G: 'a = impl Iterator<Item=Result<Arc<Self::Node>, Self::InitTargetedError>> + 'a;
type InitialTargetedNodes<'a> = impl Iterator<Item=Result<Arc<Self::Node>, Self::InitTargetedError>> + 'a where Self: 'a, S: 'a, G: 'a;

fn start<'a>(
&'a self,
Expand Down
4 changes: 2 additions & 2 deletions mapf/src/motion/graph_search.rs
Expand Up @@ -291,7 +291,7 @@ where
P::Reach: Reachable<P::Node, G, P::Waypoint>,
{
type TargetedError = ExpansionErrorOf<P, G>;
type TargetedExpansion<'a> where P: 'a, G: 'a = impl Iterator<Item=Result<Arc<P::Node>, ExpansionErrorOf<P, G>>> + 'a;
type TargetedExpansion<'a> = impl Iterator<Item=Result<Arc<P::Node>, ExpansionErrorOf<P, G>>> + 'a where P: 'a, G: 'a ;

fn expand<'a>(
&'a self,
Expand Down Expand Up @@ -338,7 +338,7 @@ where

impl<P: Policy> Aimless for Expander<P> {
type AimlessError = ExtrapolatorErrorOf<P>;
type AimlessExpansion<'a> where P: 'a = impl Iterator<Item=Result<Arc<P::Node>, Self::AimlessError>> + 'a;
type AimlessExpansion<'a> = impl Iterator<Item=Result<Arc<P::Node>, Self::AimlessError>> + 'a where P: 'a;

fn aimless_expand<'a>(
&'a self,
Expand Down
2 changes: 1 addition & 1 deletion mapf/src/motion/hold.rs
Expand Up @@ -60,7 +60,7 @@ impl<W: Waypoint, C: CostCalculator<W>, N> Expander for Hold<W, C, N> {

impl<W: Waypoint, C: CostCalculator<W, Cost=N::Cost>, N: Informed + Movable<W>, G: Goal<N>> Targeted<G> for Hold<W, C, N> {
type TargetedError = NoError;
type TargetedExpansion<'a> where W: 'a, N: 'a, C: 'a, G: 'a = impl Iterator<Item=Result<Arc<N>, NoError>>;
type TargetedExpansion<'a> = impl Iterator<Item=Result<Arc<N>, NoError>> where W: 'a, N: 'a, C: 'a, G: 'a ;

fn expand<'a>(
&'a self,
Expand Down
4 changes: 2 additions & 2 deletions mapf/src/motion/r2/graph_search.rs
Expand Up @@ -105,7 +105,7 @@ where
H: Heuristic<G::Key, G::Key, C::Cost>,
{
type InitAimlessError = InitErrorR2<G::Key, H::Error>;
type InitialAimlessNodes<'a> where G: 'a, C: 'a, H: 'a, S: 'a = impl Iterator<Item=Result<Arc<Self::Node>, Self::InitAimlessError>>;
type InitialAimlessNodes<'a> = impl Iterator<Item=Result<Arc<Self::Node>, Self::InitAimlessError>> where G: 'a, C: 'a, H: 'a, S: 'a;

fn aimless_start<'a>(
&'a self,
Expand Down Expand Up @@ -141,7 +141,7 @@ where
H: Heuristic<G::Key, G::Key, C::Cost>,
{
type InitTargetedError = InitErrorR2<G::Key, H::Error>;
type InitialTargetedNodes<'a> where G: 'a, C: 'a, H: 'a, S: 'a = impl Iterator<Item=Result<Arc<Self::Node>, Self::InitTargetedError>>;
type InitialTargetedNodes<'a> = impl Iterator<Item=Result<Arc<Self::Node>, Self::InitTargetedError>> where G: 'a, C: 'a, H: 'a, S: 'a ;

fn start<'a>(
&'a self,
Expand Down
2 changes: 1 addition & 1 deletion mapf/src/motion/reach.rs
Expand Up @@ -35,7 +35,7 @@ pub trait Reachable<Node, Goal, W: Waypoint> {
pub struct NoReach;
impl<N, G, W: Waypoint> Reachable<N, G, W> for NoReach {
type ReachError = NoError;
type Reaching<'a> where N: 'a, G: 'a, W: 'a = impl Iterator<Item=Result<Trajectory<W>, NoError>>;
type Reaching<'a> = impl Iterator<Item=Result<Trajectory<W>, NoError>> where N: 'a, G: 'a, W: 'a ;

fn reach_for<'a>(&'a self, _: &'a N, _: &'a G) -> Self::Reaching<'a> {
[].into_iter()
Expand Down
2 changes: 1 addition & 1 deletion mapf/src/motion/se2/graph_search.rs
Expand Up @@ -298,7 +298,7 @@ where
H: Heuristic<KeySE2<G::Key, RESOLUTION>, GoalSE2<G::Key>, i64>,
{
type InitTargetedError = InitErrorSE2<H::Error>;
type InitialTargetedNodes<'a> where G: 'a, C: 'a, H: 'a, S: 'a = impl Iterator<Item=Result<Arc<Node<G::Key, RESOLUTION>>, Self::InitTargetedError>> + 'a;
type InitialTargetedNodes<'a> = impl Iterator<Item=Result<Arc<Node<G::Key, RESOLUTION>>, Self::InitTargetedError>> + 'a where G: 'a, C: 'a, H: 'a, S: 'a;

fn start<'a>(
&'a self,
Expand Down
4 changes: 2 additions & 2 deletions mapf/src/node/closed_set.rs
Expand Up @@ -102,7 +102,7 @@ impl<N: Weighted + PartialKeyed> Default for PartialKeyedClosedSet<N> {
}

impl<N: Weighted + PartialKeyed> ClosedSet<N> for PartialKeyedClosedSet<N> {
type Iter<'a> where N: 'a = impl Iterator<Item=&'a Arc<N>> + 'a;
type Iter<'a> = impl Iterator<Item=&'a Arc<N>> + 'a where N: 'a;

fn close(&mut self, node: &Arc<N>) -> CloseResult<N> {
if let Some(key) = node.partial_key() {
Expand Down Expand Up @@ -169,7 +169,7 @@ impl<N: Weighted + PartialKeyed + Timed> Default for TimeVariantPartialKeyedClos
}

impl<N: Weighted + PartialKeyed + Timed> ClosedSet<N> for TimeVariantPartialKeyedClosetSet<N> {
type Iter<'a> where N: 'a = impl Iterator<Item=&'a Arc<N>> + 'a;
type Iter<'a> = impl Iterator<Item=&'a Arc<N>> + 'a where N: 'a ;

fn close(&mut self, node: &Arc<N>) -> CloseResult<N> {
if let Some(key) = node.partial_key() {
Expand Down
4 changes: 2 additions & 2 deletions mapf/src/occupancy/graph.rs
Expand Up @@ -86,7 +86,7 @@ impl<G: Grid> Graph for VisibilityGraph<G> {
type Key = Cell;
type Vertex = Point;
type Edge = (Cell, Cell);
type EdgeIter<'a> where Self: 'a = impl Iterator<Item=(Cell, Cell)> + 'a;
type EdgeIter<'a> = impl Iterator<Item=(Cell, Cell)> + 'a where Self: 'a;

fn vertex(&self, cell: Self::Key) -> Option<Self::Vertex> {
// We don't bother to filter out occupied cells because those cells will
Expand Down Expand Up @@ -162,7 +162,7 @@ impl<G: Grid> Graph for NeighborhoodGraph<G> {
type Key = Cell;
type Vertex = Point;
type Edge = (Cell, Cell);
type EdgeIter<'a> where Self: 'a = impl Iterator<Item=(Cell, Cell)> + 'a;
type EdgeIter<'a> = impl Iterator<Item=(Cell, Cell)> + 'a where Self: 'a;

fn vertex(&self, cell: Self::Key) -> Option<Self::Vertex> {
if self.visibility.grid().is_occupied(&cell) {
Expand Down

0 comments on commit 308e512

Please sign in to comment.