1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 05:40:03 -04:00

Enable a bunch more clippy lints

This commit is contained in:
Emil Ernerfeldt
2021-05-09 14:13:09 +02:00
parent 4022b84ae7
commit b1559963bf
8 changed files with 96 additions and 6 deletions

View File

@@ -60,8 +60,8 @@ impl Mesh {
/// Are all indices within the bounds of the contained vertices?
pub fn is_valid(&self) -> bool {
if self.vertices.len() <= u32::MAX as usize {
let n = self.vertices.len() as u32;
use std::convert::TryFrom;
if let Ok(n) = u32::try_from(self.vertices.len()) {
self.indices.iter().all(|&i| i < n)
} else {
false
@@ -255,8 +255,8 @@ pub struct Mesh16 {
impl Mesh16 {
/// Are all indices within the bounds of the contained vertices?
pub fn is_valid(&self) -> bool {
if self.vertices.len() <= u16::MAX as usize {
let n = self.vertices.len() as u16;
use std::convert::TryFrom;
if let Ok(n) = u16::try_from(self.vertices.len()) {
self.indices.iter().all(|&i| i < n)
} else {
false