Skip to content

Add sampling for Interval and Region. Enforce linting#12

Merged
alexespencer merged 1 commit into
mainfrom
asp/sampling
May 31, 2025
Merged

Add sampling for Interval and Region. Enforce linting#12
alexespencer merged 1 commit into
mainfrom
asp/sampling

Conversation

@alexespencer

Copy link
Copy Markdown
Owner

No description provided.

@alexespencer alexespencer requested a review from Copilot May 31, 2025 19:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

Adds random sampling support to Region and Interval, refactors APIs to use slices, and tightens linting rules.

  • Implement sample_point on Region and SampleRange for Interval
  • Change many APIs from Vec parameters 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 self requires Interval to implement Copy. Either derive Copy on Interval or revert to cloning.
vec![*self]

quadtree/src/query.rs:33

  • Using *center requires Point<N> to implement Copy. Ensure Point<N> is Copy or keep using clone().
center: *center,

quadtree/src/region.rs:115

  • Tests insert Point<N> into a HashSet, but Point<N> doesn’t derive Hash and Eq. Add #[derive(Hash, Eq)] (or use another collection) to make this compile.
use std::collections::HashSet;

@alexespencer alexespencer merged commit eafe51a into main May 31, 2025
1 check passed
@alexespencer alexespencer deleted the asp/sampling branch May 31, 2025 19:17
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

Successfully merging this pull request may close these issues.

2 participants