mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 14:54:47 +00:00
derive Default instances
This commit is contained in:
parent
009d1c8163
commit
9a74bf1f39
4 changed files with 8 additions and 35 deletions
|
@ -4,7 +4,7 @@ use crate::markup::nodes::MarkupNode;
|
||||||
|
|
||||||
pub type MarkNodeId = usize;
|
pub type MarkNodeId = usize;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Default)]
|
||||||
pub struct SlowPool {
|
pub struct SlowPool {
|
||||||
nodes: Vec<MarkupNode>,
|
nodes: Vec<MarkupNode>,
|
||||||
}
|
}
|
||||||
|
@ -69,9 +69,3 @@ impl fmt::Display for SlowPool {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for SlowPool {
|
|
||||||
fn default() -> Self {
|
|
||||||
SlowPool { nodes: Vec::new() }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ use crate::ui::util::slice_get_mut;
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Default)]
|
||||||
pub struct CodeLines {
|
pub struct CodeLines {
|
||||||
pub lines: Vec<String>,
|
pub lines: Vec<String>,
|
||||||
pub nr_of_chars: usize,
|
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 {
|
impl Lines for CodeLines {
|
||||||
fn get_line_ref(&self, line_nr: usize) -> UIResult<&str> {
|
fn get_line_ref(&self, line_nr: usize) -> UIResult<&str> {
|
||||||
let line_string = slice_get(line_nr, &self.lines)?;
|
let line_string = slice_get(line_nr, &self.lines)?;
|
||||||
|
|
|
@ -17,7 +17,9 @@ pub struct QuadBufferBuilder {
|
||||||
impl QuadBufferBuilder {
|
impl QuadBufferBuilder {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
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 {
|
impl Default for QuadBufferBuilder {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self::new()
|
||||||
vertex_data: Vec::new(),
|
|
||||||
index_data: Vec::new(),
|
|
||||||
current_quad: 0,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#[derive(Debug)]
|
// note: the Default is that these are all False
|
||||||
|
#[derive(Debug, Default)]
|
||||||
pub struct Modifiers {
|
pub struct Modifiers {
|
||||||
pub shift: bool,
|
pub shift: bool,
|
||||||
pub ctrl: bool,
|
pub ctrl: bool,
|
||||||
|
@ -6,17 +7,6 @@ pub struct Modifiers {
|
||||||
pub logo: bool,
|
pub logo: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Modifiers {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
shift: false,
|
|
||||||
ctrl: false,
|
|
||||||
alt: false,
|
|
||||||
logo: false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Modifiers {
|
impl Modifiers {
|
||||||
pub fn cmd_or_ctrl(&self) -> bool {
|
pub fn cmd_or_ctrl(&self) -> bool {
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue