Skip to content

Commit

Permalink
bug: change as_ref calls so rust beta 1.61 builds
Browse files Browse the repository at this point in the history
For context, see:
- #708
- rust-lang/rust#96074

This changes the calls from `as_ref()`, which was causing type
inference issues, to just `as_slice()` which works fine.
  • Loading branch information
ClementTsang committed Apr 27, 2022
1 parent 443dbce commit 0a9af73
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [0.6.9] / [0.7.0] - Unreleased

## Bug Fixes

- [#711](https://github.com/ClementTsang/bottom/pull/711): Fix building in Rust beta 1.61 due to `as_ref()` calls
causing type inference issues.

## Features

- [#676](https://github.com/ClementTsang/bottom/pull/676): Adds support for NVIDIA GPU temperature sensors.
Expand Down
8 changes: 4 additions & 4 deletions src/canvas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ impl Painter {
if self.derived_widget_draw_locs.is_empty() || app_state.is_force_redraw {
let draw_locs = Layout::default()
.margin(0)
.constraints(self.row_constraints.as_ref())
.constraints(self.row_constraints.as_slice())
.direction(Direction::Vertical)
.split(terminal_size);

Expand All @@ -648,7 +648,7 @@ impl Painter {
)| {
izip!(
Layout::default()
.constraints(col_constraint.as_ref())
.constraints(col_constraint.as_slice())
.direction(Direction::Horizontal)
.split(draw_loc)
.into_iter(),
Expand All @@ -659,7 +659,7 @@ impl Painter {
.map(|(split_loc, constraint, col_constraint_vec, col_rows)| {
izip!(
Layout::default()
.constraints(constraint.as_ref())
.constraints(constraint.as_slice())
.direction(Direction::Vertical)
.split(split_loc)
.into_iter(),
Expand All @@ -669,7 +669,7 @@ impl Painter {
.map(|(draw_loc, col_row_constraint_vec, widgets)| {
// Note that col_row_constraint_vec CONTAINS the widget constraints
let widget_draw_locs = Layout::default()
.constraints(col_row_constraint_vec.as_ref())
.constraints(col_row_constraint_vec.as_slice())
.direction(Direction::Horizontal)
.split(draw_loc);

Expand Down
13 changes: 5 additions & 8 deletions src/canvas/dialogs/dd_dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,14 +376,11 @@ impl KillDialog for Painter {
// Now draw buttons if needed...
let split_draw_loc = Layout::default()
.direction(Direction::Vertical)
.constraints(
if app_state.dd_err.is_some() {
vec![Constraint::Percentage(100)]
} else {
vec![Constraint::Min(3), Constraint::Length(btn_height)]
}
.as_ref(),
)
.constraints(if app_state.dd_err.is_some() {
vec![Constraint::Percentage(100)]
} else {
vec![Constraint::Min(3), Constraint::Length(btn_height)]
})
.split(draw_loc);

// This being true implies that dd_err is none.
Expand Down

0 comments on commit 0a9af73

Please sign in to comment.