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

Fix some 1.68 clippy lints #1569

Merged
merged 5 commits into from
Mar 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion crates/re_arrow_store/benches/data_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ criterion_main!(benches);

fn build_messages(n: usize) -> Vec<MsgBundle> {
(0..NUM_FRAMES)
.into_iter()
.map(move |frame_idx| {
try_build_msg_bundle2(
MsgId::ZERO,
Expand Down
4 changes: 1 addition & 3 deletions crates/re_arrow_store/src/store_read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@ impl DataStore {
let components = match (timeless, temporal) {
(None, Some(temporal)) => temporal.iter().cloned().collect_vec(),
(Some(timeless), None) => timeless.iter().cloned().collect_vec(),
(Some(timeless), Some(temporal)) => {
timeless.union(temporal).cloned().into_iter().collect_vec()
}
(Some(timeless), Some(temporal)) => timeless.union(temporal).cloned().collect_vec(),
(None, None) => return None,
};

Expand Down
6 changes: 1 addition & 5 deletions crates/re_log_types/src/datagen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use crate::{
/// Create `len` dummy rectangles
pub fn build_some_rects(len: usize) -> Vec<component_types::Rect2D> {
(0..len)
.into_iter()
.map(|i| {
component_types::Rect2D::from_xywh(i as f32, i as f32, (i / 2) as f32, (i / 2) as f32)
})
Expand All @@ -18,14 +17,13 @@ pub fn build_some_rects(len: usize) -> Vec<component_types::Rect2D> {
/// Create `len` dummy colors
pub fn build_some_colors(len: usize) -> Vec<component_types::ColorRGBA> {
(0..len)
.into_iter()
.map(|i| component_types::ColorRGBA(i as u32))
.collect()
}

/// Create `len` dummy labels
pub fn build_some_labels(len: usize) -> Vec<String> {
(0..len).into_iter().map(|i| format!("label{i}")).collect()
(0..len).map(|i| format!("label{i}")).collect()
}

/// Create `len` dummy `Point2D`
Expand All @@ -34,7 +32,6 @@ pub fn build_some_point2d(len: usize) -> Vec<component_types::Point2D> {
let mut rng = rand::thread_rng();

(0..len)
.into_iter()
.map(|_| component_types::Point2D {
x: rng.gen_range(0.0..10.0),
y: rng.gen_range(0.0..10.0),
Expand All @@ -48,7 +45,6 @@ pub fn build_some_vec3d(len: usize) -> Vec<component_types::Vec3D> {
let mut rng = rand::thread_rng();

(0..len)
.into_iter()
.map(|_| {
component_types::Vec3D::new(
rng.gen_range(0.0..10.0),
Expand Down
3 changes: 0 additions & 3 deletions crates/re_query/benches/query_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ criterion_main!(benches);
fn mono_points(c: &mut Criterion) {
// Each mono point gets logged at a different path
let paths = (0..NUM_POINTS)
.into_iter()
.map(move |point_idx| entity_path!("points", Index::Sequence(point_idx as _)))
.collect_vec();
let msgs = build_points_messages(&paths, 1);
Expand Down Expand Up @@ -124,7 +123,6 @@ fn batch_vecs(c: &mut Criterion) {

fn build_points_messages(paths: &[EntityPath], pts: usize) -> Vec<MsgBundle> {
(0..NUM_FRAMES_POINTS)
.into_iter()
.flat_map(move |frame_idx| {
paths.iter().map(move |path| {
try_build_msg_bundle2(
Expand All @@ -141,7 +139,6 @@ fn build_points_messages(paths: &[EntityPath], pts: usize) -> Vec<MsgBundle> {

fn build_vecs_messages(paths: &[EntityPath], pts: usize) -> Vec<MsgBundle> {
(0..NUM_FRAMES_VECS)
.into_iter()
.flat_map(move |frame_idx| {
paths.iter().map(move |path| {
try_build_msg_bundle1(
Expand Down
1 change: 0 additions & 1 deletion crates/re_renderer/src/allocator/uniform_buffer_fill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ pub fn create_and_fill_uniform_buffer_batch<T: bytemuck::Pod>(
staging_buffer.copy_to_buffer(ctx.active_frame.encoder.lock().get(), &buffer, 0);

(0..num_buffers)
.into_iter()
.map(|i| BindGroupEntry::Buffer {
handle: buffer.handle,
offset: i * element_size,
Expand Down
10 changes: 4 additions & 6 deletions crates/re_renderer/src/renderer/outlines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,12 +547,10 @@ impl OutlineMaskProcessor {
let uniform_buffer_jumpflooding_steps_bindings = create_and_fill_uniform_buffer_batch(
ctx,
"jumpflooding uniformbuffer".into(),
(0..num_steps)
.into_iter()
.map(|step| gpu_data::JumpfloodingStepUniformBuffer {
step_width: (max_step_width >> step).into(),
end_padding: Default::default(),
}),
(0..num_steps).map(|step| gpu_data::JumpfloodingStepUniformBuffer {
step_width: (max_step_width >> step).into(),
end_padding: Default::default(),
}),
);
let sampler = ctx.gpu_resources.samplers.get_or_create(
&ctx.device,
Expand Down
2 changes: 2 additions & 0 deletions crates/re_string_interner/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ impl StringInterner {
}

pub fn bytes_used(&self) -> usize {
// size_of_val takes references to what it wants to measure,
// and that is wat `ier()` gives us, so this is all correct.
self.map
.iter()
.map(|(k, v)| std::mem::size_of_val(k) + std::mem::size_of_val(v) + v.len())
Expand Down
10 changes: 3 additions & 7 deletions crates/re_viewer/src/ui/view_spatial/ui_2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ pub struct View2DState {
zoom: ZoomState2D,
}

#[derive(Clone, Copy)]
#[derive(Clone, Copy, Default)]
/// Sub-state specific to the Zoom/Scale/Pan engine
pub enum ZoomState2D {
#[default]
Auto,

Scaled {
/// Number of ui points per scene unit
scale: f32,
Expand All @@ -48,12 +50,6 @@ pub enum ZoomState2D {
},
}

impl Default for ZoomState2D {
fn default() -> Self {
ZoomState2D::Auto
}
}

impl View2DState {
/// Determine the optimal sub-region and size based on the `ZoomState` and
/// available size. This will generally be used to construct the painter and
Expand Down