diff options
author | Clement Tsang <34804052+ClementTsang@users.noreply.github.com> | 2022-04-27 18:34:49 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-27 18:34:49 -0400 |
commit | d43bd6147ddf418f1f5a36b23384791d1d4846d7 (patch) | |
tree | a9e30f77aaa7369667fbb80e81e36b26cad37425 /src | |
parent | 2b893ea6aa40102d5593eca3de31663b383b8315 (diff) |
bug: change as_ref() to build in Rust beta 1.61.0 (#711)
This changes various as_ref() calls as needed in order for bottom to successfully build in Rust beta 1.61, as they were causing type inference issues. These calls were either removed or changed to an alternative that does build (e.g. as_slice()).
Functionally, there should be no change.
For context, see:
- https://github.com/ClementTsang/bottom/issues/708
- https://github.com/rust-lang/rust/issues/96074
Diffstat (limited to 'src')
-rw-r--r-- | src/canvas.rs | 8 | ||||
-rw-r--r-- | src/canvas/dialogs/dd_dialog.rs | 13 |
2 files changed, 9 insertions, 12 deletions
diff --git a/src/canvas.rs b/src/canvas.rs index 447d9421..217b68a8 100644 --- a/src/canvas.rs +++ b/src/canvas.rs @@ -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); @@ -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(), @@ -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(), @@ -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); diff --git a/src/canvas/dialogs/dd_dialog.rs b/src/canvas/dialogs/dd_dialog.rs index b6bda9de..14e33354 100644 --- a/src/canvas/dialogs/dd_dialog.rs +++ b/src/canvas/dialogs/dd_dialog.rs @@ -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. |