Skip to content

Commit

Permalink
initial lints
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartonrealista committed Jul 7, 2024
1 parent 8b0b452 commit 2ad54f2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
29 changes: 14 additions & 15 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ struct Game {
}
impl Game {
fn new() -> Game {
let game = Game {

Game {
board: Board::new(4, 4),
old_board: Board::new(4, 4),
has_ended: false,
Expand All @@ -34,8 +35,7 @@ impl Game {
height: 4,
start_pressed: false,
},
};
game
}
}
}
fn pair_to_index(i: usize, j: usize, width: usize) -> usize {
Expand Down Expand Up @@ -436,7 +436,6 @@ impl Application for YourApp {
.board
.move_tile_content(key, self.game.menu.height, self.game.menu.width);
if old_board != self.game.board {
println!("aaaa");
self.game.old_board = old_board
};
}
Expand Down Expand Up @@ -500,57 +499,57 @@ fn playfield(game: &Game) -> widget::Container<'_, Message, cosmic::Theme> {
Tile {
tilecontent: Some(2),
..
} => container(centralize_tile_content(text(format!("2")).size(16)))
} => container(centralize_tile_content(text("2".to_string()).size(16)))
.style(theme::Container::custom(widget_colors::gray1theme)),
Tile {
tilecontent: Some(4),
..
} => container(centralize_tile_content(text(format!("4")).size(16)))
} => container(centralize_tile_content(text("4".to_string()).size(16)))
.style(theme::Container::custom(widget_colors::gray2theme)),
Tile {
tilecontent: Some(8),
..
} => container(centralize_tile_content(text(format!("8")).size(16)))
} => container(centralize_tile_content(text("8".to_string()).size(16)))
.style(theme::Container::custom(widget_colors::orange1theme)),
Tile {
tilecontent: Some(16),
..
} => container(centralize_tile_content(text(format!("16")).size(16)))
} => container(centralize_tile_content(text("16".to_string()).size(16)))
.style(theme::Container::custom(widget_colors::orange2theme)),
Tile {
tilecontent: Some(32),
..
} => container(centralize_tile_content(text(format!("32")).size(16)))
} => container(centralize_tile_content(text("32".to_string()).size(16)))
.style(theme::Container::custom(widget_colors::red1theme)),
Tile {
tilecontent: Some(64),
..
} => container(centralize_tile_content(text(format!("64")).size(16)))
} => container(centralize_tile_content(text("64".to_string()).size(16)))
.style(theme::Container::custom(widget_colors::red2theme)),
Tile {
tilecontent: Some(128),
..
} => container(centralize_tile_content(text(format!("128")).size(16)))
} => container(centralize_tile_content(text("128".to_string()).size(16)))
.style(theme::Container::custom(widget_colors::yellow1theme)),
Tile {
tilecontent: Some(256),
..
} => container(centralize_tile_content(text(format!("256")).size(16)))
} => container(centralize_tile_content(text("256".to_string()).size(16)))
.style(theme::Container::custom(widget_colors::yellow2theme)),
Tile {
tilecontent: Some(512),
..
} => container(centralize_tile_content(text(format!("512")).size(16)))
} => container(centralize_tile_content(text("512".to_string()).size(16)))
.style(theme::Container::custom(widget_colors::yellow3theme)),
Tile {
tilecontent: Some(1024),
..
} => container(centralize_tile_content(text(format!("1024")).size(16)))
} => container(centralize_tile_content(text("1024".to_string()).size(16)))
.style(theme::Container::custom(widget_colors::yellow4theme)),
Tile {
tilecontent: Some(2048),
..
} => container(centralize_tile_content(text(format!("2048")).size(16)))
} => container(centralize_tile_content(text("2048".to_string()).size(16)))
.style(theme::Container::custom(widget_colors::yellow5theme)),
Tile {
tilecontent: Some(content),
Expand Down
2 changes: 1 addition & 1 deletion src/app/widget_colors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ pub fn blacktheme(theme: &Theme) -> widget::container::Appearance {

pub fn secondary_with_rounder_corners(theme: &Theme) -> widget::container::Appearance {
let cosmic = theme.cosmic();
let mut appearance = theme::Container::secondary(&cosmic);
let mut appearance = theme::Container::secondary(cosmic);
appearance.border = Border {
color: Color::TRANSPARENT,
width: 1.0,
Expand Down

0 comments on commit 2ad54f2

Please sign in to comment.