From 15f794b7a89efb3299cb85b392ec13af145fb0fd Mon Sep 17 00:00:00 2001 From: Poly Date: Mon, 4 Jul 2022 01:17:29 +0200 Subject: Address Clippy lints --- native/src/hasher.rs | 8 +------- native/src/overlay/menu.rs | 22 +++++++++++++--------- native/src/program/state.rs | 2 +- native/src/user_interface.rs | 2 +- native/src/widget/checkbox.rs | 5 ++++- native/src/widget/pane_grid.rs | 3 +-- native/src/widget/pane_grid/node.rs | 20 +++++++------------- native/src/widget/pane_grid/state.rs | 5 +++++ native/src/widget/pick_list.rs | 13 ++++++------- native/src/widget/radio.rs | 8 +++----- native/src/widget/rule.rs | 2 +- native/src/widget/slider.rs | 4 ++-- native/src/widget/text.rs | 4 ++-- native/src/widget/text_input.rs | 22 +++++++++++----------- native/src/widget/text_input/editor.rs | 19 ++++++------------- native/src/widget/text_input/value.rs | 7 +++---- native/src/widget/toggler.rs | 7 +++++-- 17 files changed, 72 insertions(+), 81 deletions(-) (limited to 'native/src') diff --git a/native/src/hasher.rs b/native/src/hasher.rs index 9f6aacce..fa52f16d 100644 --- a/native/src/hasher.rs +++ b/native/src/hasher.rs @@ -1,13 +1,7 @@ /// The hasher used to compare layouts. -#[derive(Debug)] +#[derive(Debug, Default)] pub struct Hasher(twox_hash::XxHash64); -impl Default for Hasher { - fn default() -> Self { - Hasher(twox_hash::XxHash64::default()) - } -} - impl core::hash::Hasher for Hasher { fn write(&mut self, bytes: &[u8]) { self.0.write(bytes) diff --git a/native/src/overlay/menu.rs b/native/src/overlay/menu.rs index 979a13c3..0c25200c 100644 --- a/native/src/overlay/menu.rs +++ b/native/src/overlay/menu.rs @@ -174,9 +174,9 @@ where Self { container, - width: width, + width, target_height, - style: style, + style, } } } @@ -230,7 +230,7 @@ where shell: &mut Shell<'_, Message>, ) -> event::Status { self.container.on_event( - event.clone(), + event, layout, cursor_position, renderer, @@ -326,7 +326,8 @@ where use std::f32; let limits = limits.width(Length::Fill).height(Length::Shrink); - let text_size = self.text_size.unwrap_or(renderer.default_size()); + let text_size = + self.text_size.unwrap_or_else(|| renderer.default_size()); let size = { let intrinsic = Size::new( @@ -366,8 +367,9 @@ where let bounds = layout.bounds(); if bounds.contains(cursor_position) { - let text_size = - self.text_size.unwrap_or(renderer.default_size()); + let text_size = self + .text_size + .unwrap_or_else(|| renderer.default_size()); *self.hovered_option = Some( ((cursor_position.y - bounds.y) @@ -380,8 +382,9 @@ where let bounds = layout.bounds(); if bounds.contains(cursor_position) { - let text_size = - self.text_size.unwrap_or(renderer.default_size()); + let text_size = self + .text_size + .unwrap_or_else(|| renderer.default_size()); *self.hovered_option = Some( ((cursor_position.y - bounds.y) @@ -430,7 +433,8 @@ where let appearance = theme.appearance(self.style); let bounds = layout.bounds(); - let text_size = self.text_size.unwrap_or(renderer.default_size()); + let text_size = + self.text_size.unwrap_or_else(|| renderer.default_size()); let option_height = (text_size + self.padding.vertical()) as usize; let offset = viewport.y - bounds.y; diff --git a/native/src/program/state.rs b/native/src/program/state.rs index 7ec2a04f..2ddde2c2 100644 --- a/native/src/program/state.rs +++ b/native/src/program/state.rs @@ -113,7 +113,7 @@ where &mut messages, ); - messages.extend(self.queued_messages.drain(..)); + messages.append(&mut self.queued_messages); self.queued_events.clear(); debug.event_processing_finished(); diff --git a/native/src/user_interface.rs b/native/src/user_interface.rs index 97a004e7..ef6f437e 100644 --- a/native/src/user_interface.rs +++ b/native/src/user_interface.rs @@ -430,7 +430,7 @@ where overlay .as_ref() .and_then(|layout| { - root.overlay(Layout::new(&base), renderer).map(|overlay| { + root.overlay(Layout::new(base), renderer).map(|overlay| { let overlay_interaction = overlay.mouse_interaction( Layout::new(layout), cursor_position, diff --git a/native/src/widget/checkbox.rs b/native/src/widget/checkbox.rs index 9e7f183a..a49d2fa2 100644 --- a/native/src/widget/checkbox.rs +++ b/native/src/widget/checkbox.rs @@ -158,7 +158,10 @@ where Text::new(&self.label) .font(self.font.clone()) .width(self.width) - .size(self.text_size.unwrap_or(renderer.default_size())), + .size( + self.text_size + .unwrap_or_else(|| renderer.default_size()), + ), ) .layout(renderer, limits) } diff --git a/native/src/widget/pane_grid.rs b/native/src/widget/pane_grid.rs index eb969dbf..70ca772c 100644 --- a/native/src/widget/pane_grid.rs +++ b/native/src/widget/pane_grid.rs @@ -835,8 +835,7 @@ fn hovered_split<'a>( ) -> Option<(Split, Axis, Rectangle)> { splits .filter_map(|(split, (axis, region, ratio))| { - let bounds = - axis.split_line_bounds(*region, *ratio, f32::from(spacing)); + let bounds = axis.split_line_bounds(*region, *ratio, spacing); if bounds.contains(cursor_position) { Some((*split, *axis, bounds)) diff --git a/native/src/widget/pane_grid/node.rs b/native/src/widget/pane_grid/node.rs index af6573a0..cc304b96 100644 --- a/native/src/widget/pane_grid/node.rs +++ b/native/src/widget/pane_grid/node.rs @@ -36,14 +36,11 @@ impl Node { std::iter::from_fn(move || { while let Some(node) = unvisited_nodes.pop() { - match node { - Node::Split { id, a, b, .. } => { - unvisited_nodes.push(a); - unvisited_nodes.push(b); + if let Node::Split { id, a, b, .. } = node { + unvisited_nodes.push(a); + unvisited_nodes.push(b); - return Some(id); - } - _ => {} + return Some(id); } } @@ -124,12 +121,9 @@ impl Node { } pub(crate) fn update(&mut self, f: &impl Fn(&mut Node)) { - match self { - Node::Split { a, b, .. } => { - a.update(f); - b.update(f); - } - _ => {} + if let Node::Split { a, b, .. } = self { + a.update(f); + b.update(f); } f(self); diff --git a/native/src/widget/pane_grid/state.rs b/native/src/widget/pane_grid/state.rs index 6a282d24..4e90f645 100644 --- a/native/src/widget/pane_grid/state.rs +++ b/native/src/widget/pane_grid/state.rs @@ -66,6 +66,11 @@ impl State { self.panes.len() } + /// Returns `true` if the amount of panes in the [`State`] is 0. + pub fn is_empty(&self) -> bool { + self.len() == 0 + } + /// Returns the internal state of the given [`Pane`], if it exists. pub fn get(&self, pane: &Pane) -> Option<&T> { self.panes.get(pane) diff --git a/native/src/widget/pick_list.rs b/native/src/widget/pick_list.rs index c6cfcc01..e735151e 100644 --- a/native/src/widget/pick_list.rs +++ b/native/src/widget/pick_list.rs @@ -160,7 +160,7 @@ where let limits = limits.width(width).height(Length::Shrink).pad(padding); - let text_size = text_size.unwrap_or(renderer.default_size()); + let text_size = text_size.unwrap_or_else(|| renderer.default_size()); let max_width = match width { Length::Shrink => { @@ -407,10 +407,9 @@ pub fn draw( let label = selected.map(ToString::to_string); - if let Some(label) = - label.as_ref().map(String::as_str).or_else(|| placeholder) - { - let text_size = f32::from(text_size.unwrap_or(renderer.default_size())); + if let Some(label) = label.as_deref().or(placeholder) { + let text_size = + f32::from(text_size.unwrap_or_else(|| renderer.default_size())); renderer.fill_text(Text { content: label, @@ -460,7 +459,7 @@ where self.padding, self.text_size, &self.font, - self.placeholder.as_ref().map(String::as_str), + self.placeholder.as_deref(), &self.options, ) } @@ -513,7 +512,7 @@ where self.padding, self.text_size, &self.font, - self.placeholder.as_ref().map(String::as_str), + self.placeholder.as_deref(), self.selected.as_ref(), self.style, ) diff --git a/native/src/widget/radio.rs b/native/src/widget/radio.rs index ba45a0f4..647e3c5a 100644 --- a/native/src/widget/radio.rs +++ b/native/src/widget/radio.rs @@ -168,11 +168,9 @@ where .width(Length::Units(self.size)) .height(Length::Units(self.size)), ) - .push( - Text::new(&self.label) - .width(self.width) - .size(self.text_size.unwrap_or(renderer.default_size())), - ) + .push(Text::new(&self.label).width(self.width).size( + self.text_size.unwrap_or_else(|| renderer.default_size()), + )) .layout(renderer, limits) } diff --git a/native/src/widget/rule.rs b/native/src/widget/rule.rs index 26285df4..f0fda8a9 100644 --- a/native/src/widget/rule.rs +++ b/native/src/widget/rule.rs @@ -36,7 +36,7 @@ where /// Creates a vertical [`Rule`] with the given width. pub fn vertical(width: u16) -> Self { Rule { - width: Length::from(Length::Units(width)), + width: Length::Units(width), height: Length::Fill, is_horizontal: false, style: Default::default(), diff --git a/native/src/widget/slider.rs b/native/src/widget/slider.rs index bda31327..c75c1e99 100644 --- a/native/src/widget/slider.rs +++ b/native/src/widget/slider.rs @@ -303,7 +303,7 @@ pub fn draw( HandleShape::Rectangle { width, border_radius, - } => (f32::from(width), f32::from(bounds.height), border_radius), + } => (f32::from(width), bounds.height, border_radius), }; let value = value.into() as f32; @@ -447,7 +447,7 @@ where _viewport: &Rectangle, _renderer: &Renderer, ) -> mouse::Interaction { - mouse_interaction(layout, cursor_position, &self.state) + mouse_interaction(layout, cursor_position, self.state) } } diff --git a/native/src/widget/text.rs b/native/src/widget/text.rs index 242247b0..8d173b8a 100644 --- a/native/src/widget/text.rs +++ b/native/src/widget/text.rs @@ -131,7 +131,7 @@ where ) -> layout::Node { let limits = limits.width(self.width).height(self.height); - let size = self.size.unwrap_or(renderer.default_size()); + let size = self.size.unwrap_or_else(|| renderer.default_size()); let bounds = limits.max(); @@ -205,7 +205,7 @@ pub fn draw( renderer.fill_text(crate::text::Text { content, - size: f32::from(size.unwrap_or(renderer.default_size())), + size: f32::from(size.unwrap_or_else(|| renderer.default_size())), bounds: Rectangle { x, y, ..bounds }, color: appearance.color.unwrap_or(style.text_color), font, diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs index d345cec3..835b2b4d 100644 --- a/native/src/widget/text_input.rs +++ b/native/src/widget/text_input.rs @@ -198,7 +198,7 @@ pub fn layout( where Renderer: text::Renderer, { - let text_size = size.unwrap_or(renderer.default_size()); + let text_size = size.unwrap_or_else(|| renderer.default_size()); let limits = limits .pad(padding) @@ -498,7 +498,7 @@ where None => { let content: String = clipboard .read() - .unwrap_or(String::new()) + .unwrap_or_default() .chars() .filter(|c| !c.is_control()) .collect(); @@ -597,7 +597,7 @@ pub fn draw( Renderer::Theme: StyleSheet, { let secure_value = is_secure.then(|| value.secure()); - let value = secure_value.as_ref().unwrap_or(&value); + let value = secure_value.as_ref().unwrap_or(value); let bounds = layout.bounds(); let text_bounds = layout.children().next().unwrap().bounds(); @@ -623,16 +623,16 @@ pub fn draw( ); let text = value.to_string(); - let size = size.unwrap_or(renderer.default_size()); + let size = size.unwrap_or_else(|| renderer.default_size()); let (cursor, offset) = if state.is_focused() { - match state.cursor.state(&value) { + match state.cursor.state(value) { cursor::State::Index(position) => { let (text_value_width, offset) = measure_cursor_and_scroll_offset( renderer, text_bounds, - &value, + value, size, position, font.clone(), @@ -664,7 +664,7 @@ pub fn draw( measure_cursor_and_scroll_offset( renderer, text_bounds, - &value, + value, size, left, font.clone(), @@ -674,7 +674,7 @@ pub fn draw( measure_cursor_and_scroll_offset( renderer, text_bounds, - &value, + value, size, right, font.clone(), @@ -998,16 +998,16 @@ fn find_cursor_position( where Renderer: text::Renderer, { - let size = size.unwrap_or(renderer.default_size()); + let size = size.unwrap_or_else(|| renderer.default_size()); let offset = - offset(renderer, text_bounds, font.clone(), size, &value, &state); + offset(renderer, text_bounds, font.clone(), size, value, state); renderer .hit_test( &value.to_string(), size.into(), - font.clone(), + font, Size::INFINITY, Point::new(x + offset, text_bounds.height / 2.0), true, diff --git a/native/src/widget/text_input/editor.rs b/native/src/widget/text_input/editor.rs index bac530e1..d53fa8d9 100644 --- a/native/src/widget/text_input/editor.rs +++ b/native/src/widget/text_input/editor.rs @@ -15,12 +15,9 @@ impl<'a> Editor<'a> { } pub fn insert(&mut self, character: char) { - match self.cursor.selection(self.value) { - Some((left, right)) => { - self.cursor.move_left(self.value); - self.value.remove_many(left, right); - } - _ => {} + if let Some((left, right)) = self.cursor.selection(self.value) { + self.cursor.move_left(self.value); + self.value.remove_many(left, right); } self.value.insert(self.cursor.end(self.value), character); @@ -29,13 +26,9 @@ impl<'a> Editor<'a> { pub fn paste(&mut self, content: Value) { let length = content.len(); - - match self.cursor.selection(self.value) { - Some((left, right)) => { - self.cursor.move_left(self.value); - self.value.remove_many(left, right); - } - _ => {} + if let Some((left, right)) = self.cursor.selection(self.value) { + self.cursor.move_left(self.value); + self.value.remove_many(left, right); } self.value.insert_many(self.cursor.end(self.value), content); diff --git a/native/src/widget/text_input/value.rs b/native/src/widget/text_input/value.rs index 2034cca4..cf4da562 100644 --- a/native/src/widget/text_input/value.rs +++ b/native/src/widget/text_input/value.rs @@ -37,7 +37,7 @@ impl Value { let previous_string = &self.graphemes[..index.min(self.graphemes.len())].concat(); - UnicodeSegmentation::split_word_bound_indices(&previous_string as &str) + UnicodeSegmentation::split_word_bound_indices(previous_string as &str) .filter(|(_, word)| !word.trim_start().is_empty()) .next_back() .map(|(i, previous_word)| { @@ -58,9 +58,8 @@ impl Value { pub fn next_end_of_word(&self, index: usize) -> usize { let next_string = &self.graphemes[index..].concat(); - UnicodeSegmentation::split_word_bound_indices(&next_string as &str) - .filter(|(_, word)| !word.trim_start().is_empty()) - .next() + UnicodeSegmentation::split_word_bound_indices(next_string as &str) + .find(|(_, word)| !word.trim_start().is_empty()) .map(|(i, next_word)| { index + UnicodeSegmentation::graphemes(next_word, true).count() diff --git a/native/src/widget/toggler.rs b/native/src/widget/toggler.rs index 0936c271..3deaf287 100644 --- a/native/src/widget/toggler.rs +++ b/native/src/widget/toggler.rs @@ -162,7 +162,10 @@ where .horizontal_alignment(self.text_alignment) .font(self.font.clone()) .width(self.width) - .size(self.text_size.unwrap_or(renderer.default_size())), + .size( + self.text_size + .unwrap_or_else(|| renderer.default_size()), + ), ); } @@ -239,7 +242,7 @@ where renderer, style, label_layout, - &label, + label, self.text_size, self.font.clone(), Default::default(), -- cgit From 2f76a10a1d3617e414fb33c0c6cd5cb7782197ad Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 9 Jul 2022 18:03:59 +0200 Subject: Fix further `clippy` lints ... and explicitly annotate crates as well. --- native/src/debug/null.rs | 2 +- native/src/lib.rs | 18 +++++++++++++----- native/src/overlay/menu.rs | 8 ++++---- native/src/renderer/null.rs | 2 +- native/src/widget/button.rs | 2 +- native/src/widget/column.rs | 6 ++++++ native/src/widget/pick_list.rs | 10 +++++----- native/src/widget/progress_bar.rs | 2 +- native/src/widget/row.rs | 6 ++++++ native/src/widget/scrollable.rs | 6 +++--- native/src/widget/slider.rs | 4 ++-- native/src/widget/text_input.rs | 2 +- 12 files changed, 44 insertions(+), 24 deletions(-) (limited to 'native/src') diff --git a/native/src/debug/null.rs b/native/src/debug/null.rs index 60e6122d..2db0eebb 100644 --- a/native/src/debug/null.rs +++ b/native/src/debug/null.rs @@ -1,5 +1,5 @@ #![allow(missing_docs)] -#[derive(Debug)] +#[derive(Debug, Default)] pub struct Debug; impl Debug { diff --git a/native/src/lib.rs b/native/src/lib.rs index 2d0dd6ec..13173901 100644 --- a/native/src/lib.rs +++ b/native/src/lib.rs @@ -31,11 +31,19 @@ #![doc( html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg" )] -#![deny(missing_docs)] -#![deny(missing_debug_implementations)] -#![deny(unused_results)] -#![forbid(unsafe_code)] -#![forbid(rust_2018_idioms)] +#![deny( + missing_debug_implementations, + missing_docs, + unused_results, + clippy::extra_unused_lifetimes, + clippy::from_over_into, + clippy::needless_borrow, + clippy::new_without_default, + clippy::useless_conversion +)] +#![forbid(unsafe_code, rust_2018_idioms)] +#![allow(clippy::inherent_to_string, clippy::type_complexity)] +#![cfg_attr(docsrs, feature(doc_cfg))] pub mod clipboard; pub mod command; pub mod event; diff --git a/native/src/overlay/menu.rs b/native/src/overlay/menu.rs index 0c25200c..fc3f52b2 100644 --- a/native/src/overlay/menu.rs +++ b/native/src/overlay/menu.rs @@ -489,15 +489,15 @@ where } } -impl<'a, T, Message, Renderer> Into> - for List<'a, T, Renderer> +impl<'a, T, Message, Renderer> From> + for Element<'a, Message, Renderer> where T: ToString + Clone, Message: 'a, Renderer: 'a + text::Renderer, Renderer::Theme: StyleSheet, { - fn into(self) -> Element<'a, Message, Renderer> { - Element::new(self) + fn from(list: List<'a, T, Renderer>) -> Self { + Element::new(list) } } diff --git a/native/src/renderer/null.rs b/native/src/renderer/null.rs index c591f4e2..b1743dbf 100644 --- a/native/src/renderer/null.rs +++ b/native/src/renderer/null.rs @@ -5,7 +5,7 @@ use crate::{Background, Font, Point, Rectangle, Size, Theme, Vector}; /// A renderer that does nothing. /// /// It can be useful if you are writing tests! -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone, Copy, Default)] pub struct Null; impl Null { diff --git a/native/src/widget/button.rs b/native/src/widget/button.rs index d4e88424..a33ee7f7 100644 --- a/native/src/widget/button.rs +++ b/native/src/widget/button.rs @@ -382,7 +382,7 @@ where self.on_press.is_some(), theme, self.style, - || &self.state, + || self.state, ); self.content.draw( diff --git a/native/src/widget/column.rs b/native/src/widget/column.rs index 01ddd9f1..4eee7d3c 100644 --- a/native/src/widget/column.rs +++ b/native/src/widget/column.rs @@ -102,6 +102,12 @@ impl<'a, Message, Renderer> Column<'a, Message, Renderer> { } } +impl<'a, Message, Renderer> Default for Column<'a, Message, Renderer> { + fn default() -> Self { + Self::new() + } +} + impl<'a, Message, Renderer> Widget for Column<'a, Message, Renderer> where diff --git a/native/src/widget/pick_list.rs b/native/src/widget/pick_list.rs index e735151e..61b0eb96 100644 --- a/native/src/widget/pick_list.rs +++ b/native/src/widget/pick_list.rs @@ -525,7 +525,7 @@ where ) -> Option> { overlay( layout, - &mut self.state, + self.state, self.padding, self.text_size, self.font.clone(), @@ -535,8 +535,8 @@ where } } -impl<'a, T: 'a, Message, Renderer> Into> - for PickList<'a, T, Message, Renderer> +impl<'a, T: 'a, Message, Renderer> From> + for Element<'a, Message, Renderer> where T: Clone + ToString + Eq, [T]: ToOwned>, @@ -549,7 +549,7 @@ where ::Style: Into<::Style>, { - fn into(self) -> Element<'a, Message, Renderer> { - Element::new(self) + fn from(pick_list: PickList<'a, T, Message, Renderer>) -> Self { + Element::new(pick_list) } } diff --git a/native/src/widget/progress_bar.rs b/native/src/widget/progress_bar.rs index 4eb7438a..50bdcda6 100644 --- a/native/src/widget/progress_bar.rs +++ b/native/src/widget/progress_bar.rs @@ -76,7 +76,7 @@ where } } -impl<'a, Message, Renderer> Widget for ProgressBar +impl Widget for ProgressBar where Renderer: crate::Renderer, Renderer::Theme: StyleSheet, diff --git a/native/src/widget/row.rs b/native/src/widget/row.rs index 9cff74c6..9d8cc715 100644 --- a/native/src/widget/row.rs +++ b/native/src/widget/row.rs @@ -102,6 +102,12 @@ impl<'a, Message, Renderer> Row<'a, Message, Renderer> { } } +impl<'a, Message, Renderer> Default for Row<'a, Message, Renderer> { + fn default() -> Self { + Self::new() + } +} + impl<'a, Message, Renderer> Widget for Row<'a, Message, Renderer> where diff --git a/native/src/widget/scrollable.rs b/native/src/widget/scrollable.rs index 5d550315..1b255860 100644 --- a/native/src/widget/scrollable.rs +++ b/native/src/widget/scrollable.rs @@ -662,7 +662,7 @@ where shell: &mut Shell<'_, Message>, ) -> event::Status { update( - &mut self.state, + self.state, event, layout, cursor_position, @@ -693,7 +693,7 @@ where renderer: &Renderer, ) -> mouse::Interaction { mouse_interaction( - &self.state, + self.state, layout, cursor_position, self.scrollbar_width, @@ -720,7 +720,7 @@ where _viewport: &Rectangle, ) { draw( - &self.state, + self.state, renderer, theme, layout, diff --git a/native/src/widget/slider.rs b/native/src/widget/slider.rs index c75c1e99..a5ff611c 100644 --- a/native/src/widget/slider.rs +++ b/native/src/widget/slider.rs @@ -410,7 +410,7 @@ where layout, cursor_position, shell, - &mut self.state, + self.state, &mut self.value, &self.range, self.step, @@ -432,7 +432,7 @@ where renderer, layout, cursor_position, - &self.state, + self.state, self.value, &self.range, theme, diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs index 835b2b4d..98265ef2 100644 --- a/native/src/widget/text_input.rs +++ b/native/src/widget/text_input.rs @@ -176,7 +176,7 @@ where theme, layout, cursor_position, - &self.state, + self.state, value.unwrap_or(&self.value), &self.placeholder, self.size, -- cgit From 2065a40f642589134142a740ff4198deaa4c378b Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 9 Jul 2022 18:42:41 +0200 Subject: Fix `clippy` lints for all crates and features ... and check those in CI as well! --- native/src/debug/basic.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'native/src') diff --git a/native/src/debug/basic.rs b/native/src/debug/basic.rs index d706bb00..603f2fd5 100644 --- a/native/src/debug/basic.rs +++ b/native/src/debug/basic.rs @@ -186,6 +186,12 @@ impl Debug { } } +impl Default for Debug { + fn default() -> Self { + Self::new() + } +} + #[derive(Debug)] struct TimeBuffer { head: usize, -- cgit