resolve new clippy lints
This commit is contained in:
parent
f3ae4581c7
commit
7358d8c9cb
|
@ -87,7 +87,7 @@ pub fn run_winit(log: Logger) {
|
||||||
let data = WinitData {
|
let data = WinitData {
|
||||||
#[cfg(feature = "debug")]
|
#[cfg(feature = "debug")]
|
||||||
fps_texture: import_bitmap(
|
fps_texture: import_bitmap(
|
||||||
&mut renderer.borrow_mut().renderer(),
|
renderer.borrow_mut().renderer(),
|
||||||
&image::io::Reader::with_format(std::io::Cursor::new(FPS_NUMBERS_PNG), image::ImageFormat::Png)
|
&image::io::Reader::with_format(std::io::Cursor::new(FPS_NUMBERS_PNG), image::ImageFormat::Png)
|
||||||
.decode()
|
.decode()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
|
@ -70,6 +70,7 @@ impl<A: AsRawFd + 'static> Drop for FdWrapper<A> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
#[allow(clippy::large_enum_variant)]
|
||||||
pub enum DrmDeviceInternal<A: AsRawFd + 'static> {
|
pub enum DrmDeviceInternal<A: AsRawFd + 'static> {
|
||||||
Atomic(AtomicDrmDevice<A>),
|
Atomic(AtomicDrmDevice<A>),
|
||||||
Legacy(LegacyDrmDevice<A>),
|
Legacy(LegacyDrmDevice<A>),
|
||||||
|
|
|
@ -36,6 +36,7 @@ pub struct DrmSurface<A: AsRawFd + 'static> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
#[allow(clippy::large_enum_variant)]
|
||||||
pub enum DrmSurfaceInternal<A: AsRawFd + 'static> {
|
pub enum DrmSurfaceInternal<A: AsRawFd + 'static> {
|
||||||
Atomic(AtomicDrmSurface<A>),
|
Atomic(AtomicDrmSurface<A>),
|
||||||
Legacy(LegacyDrmSurface<A>),
|
Legacy(LegacyDrmSurface<A>),
|
||||||
|
|
|
@ -199,7 +199,7 @@ impl EGLNativeDisplay for EGLDevice {
|
||||||
|
|
||||||
/// Trait for types returning valid surface pointers for initializing egl
|
/// Trait for types returning valid surface pointers for initializing egl
|
||||||
///
|
///
|
||||||
/// ## Unsafety
|
/// ## Safety
|
||||||
///
|
///
|
||||||
/// The returned [`NativeWindowType`](ffi::NativeWindowType) must be valid for EGL
|
/// The returned [`NativeWindowType`](ffi::NativeWindowType) must be valid for EGL
|
||||||
/// and there is no way to test that.
|
/// and there is no way to test that.
|
||||||
|
|
|
@ -244,18 +244,12 @@ pub enum RectangleKind {
|
||||||
/// This struct contains an ordered `Vec` containing the rectangles defining
|
/// This struct contains an ordered `Vec` containing the rectangles defining
|
||||||
/// a region. They should be added or subtracted in this order to compute the
|
/// a region. They should be added or subtracted in this order to compute the
|
||||||
/// actual contents of the region.
|
/// actual contents of the region.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug, Default)]
|
||||||
pub struct RegionAttributes {
|
pub struct RegionAttributes {
|
||||||
/// List of rectangle part of this region
|
/// List of rectangle part of this region
|
||||||
pub rects: Vec<(RectangleKind, Rectangle<i32, Logical>)>,
|
pub rects: Vec<(RectangleKind, Rectangle<i32, Logical>)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for RegionAttributes {
|
|
||||||
fn default() -> RegionAttributes {
|
|
||||||
RegionAttributes { rects: Vec::new() }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl RegionAttributes {
|
impl RegionAttributes {
|
||||||
/// Checks whether given point is inside the region.
|
/// Checks whether given point is inside the region.
|
||||||
pub fn contains<P: Into<Point<i32, Logical>>>(&self, point: P) -> bool {
|
pub fn contains<P: Into<Point<i32, Logical>>>(&self, point: P) -> bool {
|
||||||
|
|
|
@ -61,20 +61,12 @@ pub enum BlockerState {
|
||||||
Cancelled,
|
Cancelled,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
struct TransactionState {
|
struct TransactionState {
|
||||||
surfaces: Vec<(WlSurface, Serial)>,
|
surfaces: Vec<(WlSurface, Serial)>,
|
||||||
blockers: Vec<Box<dyn Blocker + Send>>,
|
blockers: Vec<Box<dyn Blocker + Send>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for TransactionState {
|
|
||||||
fn default() -> Self {
|
|
||||||
TransactionState {
|
|
||||||
surfaces: Vec::new(),
|
|
||||||
blockers: Vec::new(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl TransactionState {
|
impl TransactionState {
|
||||||
fn insert(&mut self, surface: WlSurface, id: Serial) {
|
fn insert(&mut self, surface: WlSurface, id: Serial) {
|
||||||
if let Some(place) = self.surfaces.iter_mut().find(|place| place.0 == surface) {
|
if let Some(place) = self.surfaces.iter_mut().find(|place| place.0 == surface) {
|
||||||
|
@ -213,21 +205,13 @@ impl Transaction {
|
||||||
}
|
}
|
||||||
|
|
||||||
// This queue should be per-client
|
// This queue should be per-client
|
||||||
|
#[derive(Default)]
|
||||||
pub(crate) struct TransactionQueue {
|
pub(crate) struct TransactionQueue {
|
||||||
transactions: Vec<Transaction>,
|
transactions: Vec<Transaction>,
|
||||||
// we keep the hashset around to reuse allocations
|
// we keep the hashset around to reuse allocations
|
||||||
seen_surfaces: HashSet<u32>,
|
seen_surfaces: HashSet<u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for TransactionQueue {
|
|
||||||
fn default() -> Self {
|
|
||||||
TransactionQueue {
|
|
||||||
transactions: Vec::new(),
|
|
||||||
seen_surfaces: HashSet::new(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl TransactionQueue {
|
impl TransactionQueue {
|
||||||
pub(crate) fn append(&mut self, t: Transaction) {
|
pub(crate) fn append(&mut self, t: Transaction) {
|
||||||
self.transactions.push(t);
|
self.transactions.push(t);
|
||||||
|
|
|
@ -87,7 +87,7 @@ impl ExplicitBufferRelease {
|
||||||
///
|
///
|
||||||
/// When processing the current state, [`Option::take`] the values from it. Otherwise they'll be
|
/// When processing the current state, [`Option::take`] the values from it. Otherwise they'll be
|
||||||
/// treated as unused and released when overwritten by the next client commit.
|
/// treated as unused and released when overwritten by the next client commit.
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Default)]
|
||||||
pub struct ExplicitSyncState {
|
pub struct ExplicitSyncState {
|
||||||
/// An acquire `dma_fence` object, that you should wait on before accessing the contents of the
|
/// An acquire `dma_fence` object, that you should wait on before accessing the contents of the
|
||||||
/// buffer associated with the surface.
|
/// buffer associated with the surface.
|
||||||
|
@ -97,15 +97,6 @@ pub struct ExplicitSyncState {
|
||||||
pub release: Option<ExplicitBufferRelease>,
|
pub release: Option<ExplicitBufferRelease>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for ExplicitSyncState {
|
|
||||||
fn default() -> Self {
|
|
||||||
ExplicitSyncState {
|
|
||||||
acquire: None,
|
|
||||||
release: None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Cacheable for ExplicitSyncState {
|
impl Cacheable for ExplicitSyncState {
|
||||||
fn commit(&mut self) -> Self {
|
fn commit(&mut self) -> Self {
|
||||||
std::mem::take(self)
|
std::mem::take(self)
|
||||||
|
|
|
@ -346,7 +346,7 @@ impl Output {
|
||||||
|
|
||||||
/// This function allows to run a [FnMut] on every
|
/// This function allows to run a [FnMut] on every
|
||||||
/// [WlOutput] matching the same [Client] as provided
|
/// [WlOutput] matching the same [Client] as provided
|
||||||
pub fn with_client_outputs<F>(&self, client: Client, mut f: F)
|
pub fn with_client_outputs<F>(&self, client: Client, f: F)
|
||||||
where
|
where
|
||||||
F: FnMut(&WlOutput),
|
F: FnMut(&WlOutput),
|
||||||
{
|
{
|
||||||
|
@ -359,7 +359,7 @@ impl Output {
|
||||||
Some(output_client) => output_client.equals(&client),
|
Some(output_client) => output_client.equals(&client),
|
||||||
None => false,
|
None => false,
|
||||||
})
|
})
|
||||||
.for_each(|output| f(output))
|
.for_each(f)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sends `wl_surface.enter` for the provided surface
|
/// Sends `wl_surface.enter` for the provided surface
|
||||||
|
|
|
@ -66,7 +66,7 @@ impl ModifiersState {
|
||||||
/// For details, see the [documentation at xkbcommon.org][docs].
|
/// For details, see the [documentation at xkbcommon.org][docs].
|
||||||
///
|
///
|
||||||
/// [docs]: https://xkbcommon.org/doc/current/structxkb__rule__names.html
|
/// [docs]: https://xkbcommon.org/doc/current/structxkb__rule__names.html
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Default, Clone, Debug)]
|
||||||
pub struct XkbConfig<'a> {
|
pub struct XkbConfig<'a> {
|
||||||
/// The rules file to use.
|
/// The rules file to use.
|
||||||
///
|
///
|
||||||
|
@ -86,18 +86,6 @@ pub struct XkbConfig<'a> {
|
||||||
pub options: Option<String>,
|
pub options: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Default for XkbConfig<'a> {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
rules: "",
|
|
||||||
model: "",
|
|
||||||
layout: "",
|
|
||||||
variant: "",
|
|
||||||
options: None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct KbdInternal {
|
struct KbdInternal {
|
||||||
known_kbds: Vec<WlKeyboard>,
|
known_kbds: Vec<WlKeyboard>,
|
||||||
focus: Option<WlSurface>,
|
focus: Option<WlSurface>,
|
||||||
|
|
|
@ -388,7 +388,7 @@ xdg_role!(
|
||||||
);
|
);
|
||||||
|
|
||||||
/// Represents the state of the popup
|
/// Represents the state of the popup
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Default, Clone, Copy, PartialEq)]
|
||||||
pub struct PopupState {
|
pub struct PopupState {
|
||||||
/// The positioner state can be used by the compositor
|
/// The positioner state can be used by the compositor
|
||||||
/// to calculate the best placement for the popup.
|
/// to calculate the best placement for the popup.
|
||||||
|
@ -408,15 +408,6 @@ pub struct PopupState {
|
||||||
pub geometry: Rectangle<i32, Logical>,
|
pub geometry: Rectangle<i32, Logical>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for PopupState {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
geometry: Default::default(),
|
|
||||||
positioner: Default::default(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||||
/// The state of a positioner, as set by the client
|
/// The state of a positioner, as set by the client
|
||||||
pub struct PositionerState {
|
pub struct PositionerState {
|
||||||
|
@ -598,7 +589,7 @@ impl PositionerState {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// State of a regular toplevel surface
|
/// State of a regular toplevel surface
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, Default, PartialEq)]
|
||||||
pub struct ToplevelState {
|
pub struct ToplevelState {
|
||||||
/// The suggested size of the surface
|
/// The suggested size of the surface
|
||||||
pub size: Option<Size<i32, Logical>>,
|
pub size: Option<Size<i32, Logical>>,
|
||||||
|
@ -613,17 +604,6 @@ pub struct ToplevelState {
|
||||||
pub decoration_mode: Option<zxdg_toplevel_decoration_v1::Mode>,
|
pub decoration_mode: Option<zxdg_toplevel_decoration_v1::Mode>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for ToplevelState {
|
|
||||||
fn default() -> Self {
|
|
||||||
ToplevelState {
|
|
||||||
fullscreen_output: None,
|
|
||||||
states: Default::default(),
|
|
||||||
size: None,
|
|
||||||
decoration_mode: None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Clone for ToplevelState {
|
impl Clone for ToplevelState {
|
||||||
fn clone(&self) -> ToplevelState {
|
fn clone(&self) -> ToplevelState {
|
||||||
ToplevelState {
|
ToplevelState {
|
||||||
|
@ -641,7 +621,7 @@ impl Clone for ToplevelState {
|
||||||
/// having the same `xdg_toplevel::State` multiple times
|
/// having the same `xdg_toplevel::State` multiple times
|
||||||
/// and simplifies setting and un-setting a particularly
|
/// and simplifies setting and un-setting a particularly
|
||||||
/// `xdg_toplevel::State`
|
/// `xdg_toplevel::State`
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Default, Clone, PartialEq)]
|
||||||
pub struct ToplevelStateSet {
|
pub struct ToplevelStateSet {
|
||||||
states: Vec<xdg_toplevel::State>,
|
states: Vec<xdg_toplevel::State>,
|
||||||
}
|
}
|
||||||
|
@ -711,12 +691,6 @@ impl ToplevelStateSet {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for ToplevelStateSet {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self { states: Vec::new() }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl IntoIterator for ToplevelStateSet {
|
impl IntoIterator for ToplevelStateSet {
|
||||||
type Item = xdg_toplevel::State;
|
type Item = xdg_toplevel::State;
|
||||||
type IntoIter = std::vec::IntoIter<Self::Item>;
|
type IntoIter = std::vec::IntoIter<Self::Item>;
|
||||||
|
@ -733,7 +707,7 @@ impl From<ToplevelStateSet> for Vec<xdg_toplevel::State> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents the client pending state
|
/// Represents the client pending state
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Default, Clone, Copy)]
|
||||||
pub struct SurfaceCachedState {
|
pub struct SurfaceCachedState {
|
||||||
/// Holds the double-buffered geometry that may be specified
|
/// Holds the double-buffered geometry that may be specified
|
||||||
/// by xdg_surface.set_window_geometry.
|
/// by xdg_surface.set_window_geometry.
|
||||||
|
@ -754,16 +728,6 @@ pub struct SurfaceCachedState {
|
||||||
pub max_size: Size<i32, Logical>,
|
pub max_size: Size<i32, Logical>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for SurfaceCachedState {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
geometry: None,
|
|
||||||
min_size: Default::default(),
|
|
||||||
max_size: Default::default(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Cacheable for SurfaceCachedState {
|
impl Cacheable for SurfaceCachedState {
|
||||||
fn commit(&mut self) -> Self {
|
fn commit(&mut self) -> Self {
|
||||||
*self
|
*self
|
||||||
|
|
Loading…
Reference in New Issue