chore: enforce clippy lints across workspace
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
//! Application window layout: a titlebar over a panel row.
|
||||
//!
|
||||
//! The shared flex and focus helpers live in [`crate::components::common`];
|
||||
//! they are re-exported here for the `ui::layout::…` paths.
|
||||
|
||||
use gpui::{
|
||||
App, BoxShadow, Div, ElementId, FocusHandle, Hsla, Refineable as _, StyleRefinement, Styled,
|
||||
Window, div, px,
|
||||
};
|
||||
|
||||
use crate::theme::{FOCUS_RING_ALPHA, FOCUS_RING_SPREAD};
|
||||
pub use crate::components::common::{StyledExt, focus_handle, focus_ring, h_flex, v_flex};
|
||||
|
||||
pub mod panel;
|
||||
pub mod resizable;
|
||||
@@ -15,44 +13,3 @@ pub mod titlebar;
|
||||
pub mod window_controls;
|
||||
|
||||
mod window_frame;
|
||||
|
||||
/// A row whose children center on the cross axis.
|
||||
#[must_use]
|
||||
pub fn h_flex() -> Div {
|
||||
div().flex().flex_row().items_center()
|
||||
}
|
||||
|
||||
/// A column whose children stack on the main axis.
|
||||
#[must_use]
|
||||
pub fn v_flex() -> Div {
|
||||
div().flex().flex_col()
|
||||
}
|
||||
|
||||
/// Extensions over [`Styled`], shared by the layout views.
|
||||
pub trait StyledExt: Styled + Sized {
|
||||
#[must_use]
|
||||
fn refine_style(mut self, style: &StyleRefinement) -> Self {
|
||||
self.style().refine(style);
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: Styled> StyledExt for E {}
|
||||
|
||||
/// Returns a focus handle for the given element ID.
|
||||
pub fn focus_handle(id: &ElementId, window: &mut Window, cx: &mut App) -> FocusHandle {
|
||||
window
|
||||
.with_element_namespace(id.clone(), |window| {
|
||||
window.use_keyed_state("focus-handle", cx, |_, cx| cx.focus_handle())
|
||||
})
|
||||
.read(cx)
|
||||
.clone()
|
||||
}
|
||||
|
||||
/// Returns a focus ring shadow with the given color at half ink.
|
||||
pub fn focus_ring(color: Hsla) -> Vec<BoxShadow> {
|
||||
vec![
|
||||
BoxShadow::new(px(0.), px(0.), color.alpha(FOCUS_RING_ALPHA))
|
||||
.spread_radius(FOCUS_RING_SPREAD),
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user