derive Default instances

This commit is contained in:
Folkert 2021-12-05 15:13:11 +01:00
parent 009d1c8163
commit 9a74bf1f39
4 changed files with 8 additions and 35 deletions

View File

@ -4,7 +4,7 @@ use crate::markup::nodes::MarkupNode;
pub type MarkNodeId = usize;
#[derive(Debug)]
#[derive(Debug, Default)]
pub struct SlowPool {
nodes: Vec<MarkupNode>,
}
@ -69,9 +69,3 @@ impl fmt::Display for SlowPool {
Ok(())
}
}
impl Default for SlowPool {
fn default() -> Self {
SlowPool { nodes: Vec::new() }
}
}

View File

@ -7,7 +7,7 @@ use crate::ui::util::slice_get_mut;
use std::cmp::Ordering;
use std::fmt;
#[derive(Debug)]
#[derive(Debug, Default)]
pub struct CodeLines {
pub lines: Vec<String>,
pub nr_of_chars: usize,
@ -155,15 +155,6 @@ impl CodeLines {
}
}
impl Default for CodeLines {
fn default() -> Self {
CodeLines {
lines: Vec::new(),
nr_of_chars: 0,
}
}
}
impl Lines for CodeLines {
fn get_line_ref(&self, line_nr: usize) -> UIResult<&str> {
let line_string = slice_get(line_nr, &self.lines)?;

View File

@ -17,7 +17,9 @@ pub struct QuadBufferBuilder {
impl QuadBufferBuilder {
pub fn new() -> Self {
Self {
..Default::default()
vertex_data: Vec::new(),
index_data: Vec::new(),
current_quad: 0,
}
}
@ -81,11 +83,7 @@ impl QuadBufferBuilder {
impl Default for QuadBufferBuilder {
fn default() -> Self {
Self {
vertex_data: Vec::new(),
index_data: Vec::new(),
current_quad: 0,
}
Self::new()
}
}

View File

@ -1,4 +1,5 @@
#[derive(Debug)]
// note: the Default is that these are all False
#[derive(Debug, Default)]
pub struct Modifiers {
pub shift: bool,
pub ctrl: bool,
@ -6,17 +7,6 @@ pub struct Modifiers {
pub logo: bool,
}
impl Default for Modifiers {
fn default() -> Self {
Self {
shift: false,
ctrl: false,
alt: false,
logo: false,
}
}
}
impl Modifiers {
pub fn cmd_or_ctrl(&self) -> bool {
#[cfg(target_os = "macos")]