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

End statements with semicolon (clippy::semicolon_if_nothing_returned)

This commit is contained in:
Emil Ernerfeldt
2021-10-20 16:43:40 +02:00
parent ab3be8aca3
commit d97a369c44
35 changed files with 71 additions and 72 deletions

View File

@@ -188,11 +188,11 @@ macro_rules! epaint_assert {
#[inline(always)]
pub(crate) fn f32_hash<H: std::hash::Hasher>(state: &mut H, f: f32) {
if f == 0.0 {
state.write_u8(0)
state.write_u8(0);
} else if f.is_nan() {
state.write_u8(1)
state.write_u8(1);
} else {
use std::hash::Hash;
f.to_bits().hash(state)
f.to_bits().hash(state);
}
}

View File

@@ -170,7 +170,7 @@ impl Mesh {
#[inline(always)]
pub fn add_colored_rect(&mut self, rect: Rect, color: Color32) {
crate::epaint_assert!(self.texture_id == TextureId::Egui);
self.add_rect_with_uv(rect, [WHITE_UV, WHITE_UV].into(), color)
self.add_rect_with_uv(rect, [WHITE_UV, WHITE_UV].into(), color);
}
/// This is for platforms that only support 16-bit index buffers.

View File

@@ -44,7 +44,7 @@ impl<T> Mutex<T> {
// Store it in thread local storage while we have a lock guard taken out
HELD_LOCKS_TLS.with(|locks| {
if locks.borrow().contains(&ptr) {
panic!("Recursively locking a Mutex in the same thread is not supported")
panic!("Recursively locking a Mutex in the same thread is not supported");
} else {
locks.borrow_mut().insert(ptr);
}

View File

@@ -6,7 +6,7 @@ pub fn adjust_colors(shape: &mut Shape, adjust_color: &impl Fn(&mut Color32)) {
Shape::Noop => {}
Shape::Vec(shapes) => {
for shape in shapes {
adjust_colors(shape, adjust_color)
adjust_colors(shape, adjust_color);
}
}
Shape::Circle(circle_shape) => {

View File

@@ -196,7 +196,6 @@ impl PaintStats {
}
}
Shape::Noop | Shape::Circle { .. } | Shape::LineSegment { .. } | Shape::Rect { .. } => {
Default::default()
}
Shape::Path(path_shape) => {
self.shape_path += AllocInfo::from_slice(&path_shape.points);

View File

@@ -41,7 +41,7 @@ impl Path {
#[inline(always)]
pub fn reserve(&mut self, additional: usize) {
self.0.reserve(additional)
self.0.reserve(additional);
}
#[inline(always)]
@@ -153,12 +153,12 @@ impl Path {
/// Open-ended.
pub fn stroke_open(&self, stroke: Stroke, options: &TessellationOptions, out: &mut Mesh) {
stroke_path(&self.0, PathType::Open, stroke, options, out)
stroke_path(&self.0, PathType::Open, stroke, options, out);
}
/// A closed path (returning to the first point).
pub fn stroke_closed(&self, stroke: Stroke, options: &TessellationOptions, out: &mut Mesh) {
stroke_path(&self.0, PathType::Closed, stroke, options, out)
stroke_path(&self.0, PathType::Closed, stroke, options, out);
}
pub fn stroke(
@@ -168,12 +168,12 @@ impl Path {
options: &TessellationOptions,
out: &mut Mesh,
) {
stroke_path(&self.0, path_type, stroke, options, out)
stroke_path(&self.0, path_type, stroke, options, out);
}
/// The path is taken to be closed (i.e. returning to the start again).
pub fn fill(&self, color: Color32, options: &TessellationOptions, out: &mut Mesh) {
fill_closed_path(&self.0, color, options, out)
fill_closed_path(&self.0, color, options, out);
}
}
@@ -549,7 +549,7 @@ impl Tessellator {
Shape::Noop => {}
Shape::Vec(vec) => {
for shape in vec {
self.tessellate_shape(tex_size, shape, out)
self.tessellate_shape(tex_size, shape, out);
}
}
Shape::Circle(CircleShape {
@@ -837,7 +837,7 @@ pub fn tessellate_shapes(
Stroke::new(2.0, Color32::from_rgb(150, 255, 150)),
),
mesh,
)
);
}
}

View File

@@ -34,7 +34,7 @@ pub fn layout(fonts: &Fonts, job: Arc<LayoutJob>) -> Galley {
for (i, row) in rows.iter_mut().enumerate() {
let is_last_row = i + 1 == num_rows;
let justify_row = justify && !row.ends_with_newline && !is_last_row;
halign_and_jusitfy_row(fonts, row, job.halign, job.wrap_width, justify_row)
halign_and_jusitfy_row(fonts, row, job.halign, job.wrap_width, justify_row);
}
}
@@ -74,7 +74,7 @@ fn layout_section(
let (font_impl, glyph_info) = font.glyph_info_and_font_impl(chr);
if let Some(font_impl) = font_impl {
if let Some(last_glyph_id) = last_glyph_id {
paragraph.cursor_x += font_impl.pair_kerning(last_glyph_id, glyph_info.id)
paragraph.cursor_x += font_impl.pair_kerning(last_glyph_id, glyph_info.id);
}
}