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

[red-knot] Improve ergonomics for the PySlice trait #13983

Merged
merged 1 commit into from
Oct 29, 2024
Merged

Conversation

AlexWaygood
Copy link
Member

Summary

Just a minor change to improve the ergonomics of the PySlice trait. By implementing PySlice for [T] rather than &[T], we can call it on Vec<T> and Box<[T]> without having to have intermediate calls to .as_slice() or .as_ref(). It can still be called on &[T] and &Box<[T]>, because the py_slice trait method takes &self.

Test Plan

cargo test -p red_knot_python_semantic

Copy link
Contributor

@carljm carljm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@AlexWaygood AlexWaygood merged commit 39cf46e into main Oct 29, 2024
20 checks passed
@AlexWaygood AlexWaygood deleted the alex/slice-trait branch October 29, 2024 20:41
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@sharkdp
Copy link
Contributor

sharkdp commented Oct 29, 2024

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
red-knot Multi-file analysis & type inference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants