Skip to content
Open
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
37 changes: 3 additions & 34 deletions crates/core/src/document/html/css.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use fxhash::FxHashSet;
use super::style::StyleSheet;

#[derive(Debug, Clone)]
#[derive(Debug, Clone, Default)]
pub struct Selector {
pub simple_selectors: Vec<SimpleSelector>,
pub combinators: Vec<Combinator>,
}

#[derive(Debug, Clone)]
#[derive(Debug, Clone, Default)]
pub struct SimpleSelector {
pub tag_name: Option<String>,
pub classes: FxHashSet<String>,
Expand Down Expand Up @@ -53,27 +53,6 @@ pub enum Combinator {
SubsequentSibling,
}

impl Default for Selector {
fn default() -> Self {
Selector {
simple_selectors: Vec::new(),
combinators: Vec::new(),
}
}
}

impl Default for SimpleSelector {
fn default() -> Self {
SimpleSelector {
tag_name: None,
classes: FxHashSet::default(),
pseudo_classes: Vec::new(),
attributes: Vec::new(),
id: None,
}
}
}

pub type Specificity = [usize; 3];

impl Selector {
Expand All @@ -90,23 +69,13 @@ impl Selector {
}
}

#[derive(Debug, Clone)]
#[derive(Debug, Clone, Default)]
pub struct Declaration {
pub name: String,
pub value: String,
pub important: bool,
}

impl Default for Declaration {
fn default() -> Declaration {
Declaration {
name: String::default(),
value: String::default(),
important: false,
}
}
}

#[derive(Debug, Clone)]
pub struct Rule {
pub selector: Selector,
Expand Down
52 changes: 4 additions & 48 deletions crates/core/src/document/html/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub struct RootData {
pub rect: Rectangle,
}

#[derive(Debug, Clone)]
#[derive(Debug, Clone, Default)]
pub struct DrawState {
pub position: Point,
pub floats: FxHashMap<usize, Vec<Rectangle>>,
Expand All @@ -30,19 +30,6 @@ pub struct DrawState {
pub center_table: bool,
}

impl Default for DrawState {
fn default() -> Self {
DrawState {
position: Point::default(),
floats: FxHashMap::default(),
prefix: None,
min_column_widths: Vec::new(),
max_column_widths: Vec::new(),
column_widths: Vec::new(),
center_table: false,
}
}
}

#[derive(Debug, Clone)]
pub struct StyleData {
Expand Down Expand Up @@ -114,59 +101,28 @@ pub struct ChildArtifact {
pub rects: Vec<Option<Rectangle>>,
}

#[derive(Debug, Clone)]
#[derive(Debug, Clone, Default)]
pub struct SiblingStyle {
pub padding: Edge,
pub margin: Edge,
}

#[derive(Debug, Clone)]
#[derive(Debug, Clone, Default)]
pub struct LineStats {
pub width: i32,
pub merged_width: i32,
pub glues_count: usize,
pub started: bool,
}

impl Default for LineStats {
fn default() -> Self {
LineStats {
width: 0,
merged_width: 0,
glues_count: 0,
started: false,
}
}
}

impl Default for SiblingStyle {
fn default() -> Self {
SiblingStyle {
padding: Edge::default(),
margin: Edge::default(),
}
}
}

#[derive(Debug, Clone)]
#[derive(Debug, Clone, Default)]
pub struct LoopContext {
pub index: usize,
pub sibling_style: SiblingStyle,
pub is_first: bool,
pub is_last: bool,
}

impl Default for LoopContext {
fn default() -> Self {
LoopContext {
index: 0,
sibling_style: SiblingStyle::default(),
is_first: false,
is_last: false,
}
}
}

impl Default for StyleData {
fn default() -> Self {
StyleData {
Expand Down
12 changes: 1 addition & 11 deletions crates/core/src/font/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1645,23 +1645,13 @@ struct GlyphPlan {
advance: Point,
}

#[derive(Debug, Clone)]
#[derive(Debug, Clone, Default)]
pub struct RenderPlan {
pub width: i32,
scripts: FxHashMap<usize, HbScript>,
glyphs: Vec<GlyphPlan>,
}

impl Default for RenderPlan {
fn default() -> RenderPlan {
RenderPlan {
width: 0,
scripts: FxHashMap::default(),
glyphs: Vec::new(),
}
}
}

impl RenderPlan {
pub fn scale(&self, scale: f32) -> RenderPlan {
let width = (scale * self.width as f32) as i32;
Expand Down
13 changes: 1 addition & 12 deletions crates/core/src/framebuffer/mxcfb_sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,14 @@ pub struct MxcfbUpdateMarkerData {
}

#[repr(C)]
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Default)]
pub struct MxcfbAltBufferDataV2 {
pub phys_addr: u32,
pub width: u32,
pub height: u32,
pub alt_update_region: MxcfbRect,
}

impl Default for MxcfbAltBufferDataV2 {
fn default() -> Self {
MxcfbAltBufferDataV2 {
phys_addr: 0,
width: 0,
height: 0,
alt_update_region: MxcfbRect::default(),
}
}
}

#[repr(C)]
#[derive(Clone, Debug)]
pub struct MxcfbUpdateDataV2 {
Expand Down
13 changes: 1 addition & 12 deletions crates/core/src/geom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl fmt::Display for Point {
}
}

#[derive(Debug, Copy, Clone)]
#[derive(Debug, Copy, Clone, Default)]
pub struct Edge {
pub top: i32,
pub right: i32,
Expand All @@ -147,17 +147,6 @@ impl Edge {
}
}

impl Default for Edge {
fn default() -> Self {
Edge {
top: 0,
right: 0,
bottom: 0,
left: 0,
}
}
}

impl Add for Edge {
type Output = Edge;
fn add(self, rhs: Edge) -> Edge {
Expand Down
10 changes: 1 addition & 9 deletions crates/core/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,20 +333,12 @@ pub fn device_events(rx: Receiver<InputEvent>, display: Display, button_scheme:
ry
}

#[derive(Default)]
struct TouchState {
position: Point,
pressure: i32,
}

impl Default for TouchState {
fn default() -> Self {
TouchState {
position: Point::default(),
pressure: 0,
}
}
}

pub fn parse_device_events(rx: &Receiver<InputEvent>, ty: &Sender<DeviceEvent>, display: Display, button_scheme: ButtonScheme) {
let mut id = 0;
let mut last_activity = -60;
Expand Down
12 changes: 1 addition & 11 deletions crates/core/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,14 @@ pub struct Info {
pub added: NaiveDateTime,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
pub struct FileInfo {
pub path: PathBuf,
pub kind: String,
pub size: u64,
}

impl Default for FileInfo {
fn default() -> Self {
FileInfo {
path: PathBuf::default(),
kind: String::default(),
size: u64::default(),
}
}
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct Annotation {
Expand Down
14 changes: 1 addition & 13 deletions crates/core/src/settings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ pub enum SecondColumn {
Year,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(default, rename_all = "kebab-case")]
pub struct Hook {
pub path: PathBuf,
Expand All @@ -284,18 +284,6 @@ pub struct Hook {
pub second_column: Option<SecondColumn>,
}

impl Default for Hook {
fn default() -> Self {
Hook {
path: PathBuf::default(),
program: PathBuf::default(),
sort_method: None,
first_column: None,
second_column: None,
}
}
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(default, rename_all = "kebab-case")]
pub struct HomeSettings {
Expand Down
24 changes: 2 additions & 22 deletions crates/core/src/view/home/directories_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,13 @@ pub struct DirectoriesBar {
current_page: usize,
}

#[derive(Debug, Clone)]
#[derive(Debug, Clone, Default)]
struct Page<'a> {
start_index: usize,
end_index: usize,
lines: Vec<Line<'a>>,
}

impl<'a> Default for Page<'a> {
fn default() -> Page<'a> {
Page {
start_index: 0,
end_index: 0,
lines: Vec::new(),
}
}
}

#[derive(Debug, Clone)]
struct Layout {
x_height: i32,
Expand All @@ -49,23 +39,13 @@ struct Layout {
max_lines: usize,
}

#[derive(Debug, Clone)]
#[derive(Debug, Clone, Default)]
struct Line<'a> {
width: i32,
labels_count: usize,
items: Vec<Item<'a>>,
}

impl<'a> Default for Line<'a> {
fn default() -> Line<'a> {
Line {
width: 0,
labels_count: 0,
items: Vec::new(),
}
}
}

#[derive(Debug, Clone)]
enum Item<'a> {
Label { path: &'a Path, width: i32, max_width: Option<i32> },
Expand Down