Add sampling for Interval and Region. Enforce linting#12
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
Adds random sampling support to Region and Interval, refactors APIs to use slices, and tightens linting rules.
- Implement
sample_pointonRegionandSampleRangeforInterval - Change many APIs from
Vecparameters and.clone()to slice parameters and dereference - Enforce linting by adding a Clippy step in CI
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| visualize/src/main.rs | Removed redundant format! wrapper in println! |
| quadtree/src/region.rs | Switched constructors to slice args, added sampling method |
| quadtree/src/query.rs | Replaced center.clone() with *center in DistanceQuery |
| quadtree/src/quadtree.rs | Simplified .contains calls and removed unnecessary clones |
| quadtree/src/point.rs | Changed try_new to accept slices instead of Vec<T> |
| quadtree/src/interval.rs | Implemented SampleRange for Interval and adjusted subdivision |
| .github/workflows/rust.yml | Added cargo clippy step with -D warnings |
Comments suppressed due to low confidence (4)
quadtree/src/region.rs:4
- The import path "rand::distr::uniform::SampleRange" is incorrect; it should be "rand::distributions::uniform::SampleRange".
use rand::{Rng, distr::uniform::SampleRange};
quadtree/src/interval.rs:36
- Dereferencing
selfrequiresIntervalto implementCopy. Either deriveCopyonIntervalor revert to cloning.
vec![*self]
quadtree/src/query.rs:33
- Using
*centerrequiresPoint<N>to implementCopy. EnsurePoint<N>isCopyor keep usingclone().
center: *center,
quadtree/src/region.rs:115
- Tests insert
Point<N>into aHashSet, butPoint<N>doesn’t deriveHashandEq. Add#[derive(Hash, Eq)](or use another collection) to make this compile.
use std::collections::HashSet;
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.