fn remove_indexed(
        &mut self,
        span: Span,
        item: &Item,
    ) -> Result<Option<IndexedEntry>, QueryError> {
        // See if there's an index entry we can construct and insert.
        let entries = match self.indexed.remove(item) {
            Some(entries) => entries,
            None => return Ok(None),
        };

        let mut it = entries.into_iter().peekable();

        let mut cur = match it.next() {
            Some(first) => first,
            None => return Ok(None),
        };

        if it.peek().is_none() {
            return Ok(Some(cur));
        }

        let mut locations = vec![(cur.item.location, cur.item().clone())];

        while let Some(oth) = it.next() {
            locations.push((oth.item.location, oth.item().clone()));

            if let (Indexed::Import(a), Indexed::Import(b)) = (&cur.indexed, &oth.indexed) {
                if a.wildcard {
                    cur = oth;
                    continue;
                }

                if b.wildcard {
                    continue;
                }
            }

            for oth in it {
                locations.push((oth.item.location, oth.item().clone()));
            }

            return Err(QueryError::new(
                span,
                QueryErrorKind::AmbiguousItem {
                    item: cur.item.item.clone(),
                    locations,
                },
            ));
        }

        if let Indexed::Import(Import { wildcard: true, .. }) = &cur.indexed {
            return Err(QueryError::new(
                span,
                QueryErrorKind::AmbiguousItem {
                    item: cur.item.item.clone(),
                    locations,
                },
            ));
        }

        Ok(Some(cur))
    }
/// Remove the indexed entry corresponding to the given item..
Remove the indexed entry corresponding to the given item
Remove the indexed entry corresponding to the given item
fn remove_indexed(
        &mut self,
        span: Span,
        item: &Item,
    ) -> Result<Option<IndexedEntry>, QueryError> {
        // See if there's an index entry we can construct and insert.
        let entries = match self.indexed.remove(item) {
            Some(entries) => entries,
            None => return Ok(None),
        };
        let mut it = entries.into_iter().peekable();
        let mut cur = match it.next() {
            Some(first) => first,
            None => return Ok(None),
        };
        if it.peek().is_none() {
            return Ok(Some(cur));
        }
        let mut locations = vec![(cur.item.location, cur.item().clone())];
        while let Some(oth) = it.next() {
            locations.push((oth.item.location, oth.item().clone()));
            if let (Indexed::Import(a), Indexed::Import(b)) = (&cur.indexed, &oth.indexed) {
                if a.wildcard {
                    cur = oth;
                    continue;
                }
                if b.wildcard {
                    continue;
                }
            }
            for oth in it {
                locations.push((oth.item.location, oth.item().clone()));
            }
            return Err(QueryError::new(
                span,
                QueryErrorKind::AmbiguousItem {
                    item: cur.item.item.clone(),
                    locations,
                },
            ));
        }
        if let Indexed::Import(Import { wildcard: true, .. }) = &cur.indexed {
            return Err(QueryError::new(
                span,
                QueryErrorKind::AmbiguousItem {
                    item: cur.item.item.clone(),
                    locations,
                },
            ));
        }
        Ok(Some(cur))
    }
fn remove_indexed ( & mut self , span : Span , item : & Item , ) -> Result < Option < IndexedEntry > , QueryError > { // See if there's an index entry we can construct and insert. let entries = match self . indexed . remove ( item ) { Some ( entries ) => entries , None => return Ok ( None ) , } ; let mut it = entries . into_iter ( ) . peekable ( ) ; let mut cur = match it . next ( ) { Some ( first ) => first , None => return Ok ( None ) , } ; if it . peek ( ) . is_none ( ) { return Ok ( Some ( cur ) ) ; } let mut locations = vec ! [ ( cur item location cur item ( ) clone ( ) ) ] ; while let Some ( oth ) = it . next ( ) { locations . push ( ( oth . item . location , oth . item ( ) . clone ( ) ) ) ; if let ( Indexed :: Import ( a ) , Indexed :: Import ( b ) ) = ( & cur . indexed , & oth . indexed ) { if a . wildcard { cur = oth ; continue ; } if b . wildcard { continue ; } } for oth in it { locations . push ( ( oth . item . location , oth . item ( ) . clone ( ) ) ) ; } return Err ( QueryError :: new ( span , QueryErrorKind :: AmbiguousItem { item : cur . item . item . clone ( ) , locations , } , ) ) ; } if let Indexed :: Import ( Import { wildcard : true , .. } ) = & cur . indexed { return Err ( QueryError :: new ( span , QueryErrorKind :: AmbiguousItem { item : cur . item . item . clone ( ) , locations , } , ) ) ; } Ok ( Some ( cur ) ) }
Remove the indexed entry corresponding to the given item..
Remove the indexed entry corresponding to the given item ..
&mut self
span
Span
item
&Item
&mut self
span
Span
item
&Item