1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 14:20:04 -04:00

Use Self everywhere (#3787)

This turns on the clippy lint
[`clippy::use_self`](https://rust-lang.github.io/rust-clippy/v0.0.212/index.html#use_self)
and fixes it everywhere.
This commit is contained in:
Emil Ernerfeldt
2024-01-08 17:41:21 +01:00
committed by GitHub
parent 12ad9e7b36
commit 401de05630
72 changed files with 590 additions and 580 deletions

View File

@@ -32,9 +32,9 @@ impl<T> From<&[T]> for AllocInfo {
}
impl std::ops::Add for AllocInfo {
type Output = AllocInfo;
type Output = Self;
fn add(self, rhs: AllocInfo) -> AllocInfo {
fn add(self, rhs: Self) -> Self {
use ElementSize::{Heterogenous, Homogeneous, Unknown};
let element_size = match (self.element_size, rhs.element_size) {
(Heterogenous, _) | (_, Heterogenous) => Heterogenous,
@@ -43,7 +43,7 @@ impl std::ops::Add for AllocInfo {
_ => Heterogenous,
};
AllocInfo {
Self {
element_size,
num_allocs: self.num_allocs + rhs.num_allocs,
num_elements: self.num_elements + rhs.num_elements,
@@ -53,7 +53,7 @@ impl std::ops::Add for AllocInfo {
}
impl std::ops::AddAssign for AllocInfo {
fn add_assign(&mut self, rhs: AllocInfo) {
fn add_assign(&mut self, rhs: Self) {
*self = *self + rhs;
}
}