Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index double assert? #12

Open
tower120 opened this issue Jul 17, 2021 · 1 comment
Open

Index double assert? #12

tower120 opened this issue Jul 17, 2021 · 1 comment

Comments

@tower120
Copy link

fn index(&self, id: A::Id) -> &T {

Since you already do safety check assert_eq!(self.arena_id, A::arena_id(id));, maybe it is possible to use self.items.get instead of []?
In order to omit Vec's assert inside Index.

@LindonKelley
Copy link

If I'm understanding the issue correctly, I believe you are confusing the arena_id check as being equivalent to the Vec index check, or were you actually implying that if the arena_id is equivalent then id must be inside the range of self.items?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants