Skip to content

Commit

Permalink
fix missing semicolons and redundant references
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrgani authored and not-fl3 committed Sep 23, 2024
1 parent 8afbff8 commit 1094e74
Show file tree
Hide file tree
Showing 18 changed files with 30 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/audio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,5 +154,5 @@ pub fn stop_sound(sound: &Sound) {

pub fn set_sound_volume(sound: &Sound, volume: f32) {
let ctx = &mut get_context().audio_context;
sound.0 .0.set_volume(&mut ctx.native_ctx, volume)
sound.0 .0.set_volume(&mut ctx.native_ctx, volume);
}
2 changes: 1 addition & 1 deletion src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ fn waker() -> Waker {
)
}
unsafe fn wake_by_ref(data: *const ()) {
wake(data)
wake(data);
}
unsafe fn drop(_data: *const ()) {
// Nothing to do
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ impl EventHandler for Stage {
character,
modifiers,
repeat,
})
});
});
}

Expand All @@ -667,7 +667,7 @@ impl EventHandler for Stage {
keycode,
modifiers,
repeat,
})
});
});
if context
.update_on
Expand Down
2 changes: 1 addition & 1 deletion src/telemetry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ impl<'a> Drop for LogTimeGuard<'a> {
"Time query: {}, {:.1}s",
self.name,
get_time() - self.start_time
))
));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ pub fn draw_multiline_text(
color,
..Default::default()
},
)
);
}

/// Draw multiline text with the given line distance and custom params such as font, font size and font scale.
Expand Down
4 changes: 2 additions & 2 deletions src/texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ impl Texture2D {
match &self.texture {
TextureHandle::Unmanaged(id) => Texture2D::unmanaged(*id),
TextureHandle::Managed(t) => Texture2D {
texture: TextureHandle::ManagedWeak((**t).0),
texture: TextureHandle::ManagedWeak(t.0),
},
TextureHandle::ManagedWeak(t) => Texture2D {
texture: TextureHandle::ManagedWeak(*t),
Expand Down Expand Up @@ -749,7 +749,7 @@ impl Texture2D {
width,
height,
&image.bytes,
)
);
}

/// Returns the width of this texture.
Expand Down
4 changes: 2 additions & 2 deletions src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ impl Ui {
/// If you want your widget to start with its scrollbar in a particular location,
/// consider `if ui.frame == 1 { ui.scroll_here() }`.
pub fn scroll_here(&mut self) {
self.scroll_here_ratio(0.5)
self.scroll_here_ratio(0.5);
}

/// Scrolls the active GUI window to its GUI cursor.
Expand Down Expand Up @@ -1359,7 +1359,7 @@ pub(crate) mod ui_context {
}

fn set(&mut self, data: &str) {
miniquad::window::clipboard_set(data)
miniquad::window::clipboard_set(data);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/ui/render/mesh_rasterizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ fn get_active_draw_list<'a, 'b>(
match command {
DrawCommand::Clip { rect, .. } => {
if last.clipping_zone != *rect {
draw_lists.push(DrawList::new())
draw_lists.push(DrawList::new());
}
}
DrawCommand::DrawRawTexture { texture, .. } => {
Expand Down
12 changes: 6 additions & 6 deletions src/ui/render/painter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ impl Painter {

let size = match content {
UiContent::Label(label) => {
let text_measures = self.label_size(&*label, None, font, font_size);
let text_measures = self.label_size(label, None, font, font_size);
(text_measures.width, font_size as f32)
}
UiContent::Texture(texture) => (texture.width(), texture.height()),
Expand Down Expand Up @@ -278,7 +278,7 @@ impl Painter {
element_size.y / 2. - text_measures.height / 2. + text_measures.offset_y;

self.draw_label(
&*data,
data,
element_pos + Vec2::new(left_coord, top_coord),
Some(text_color),
font,
Expand Down Expand Up @@ -412,7 +412,7 @@ impl Painter {
self.add_command(DrawCommand::DrawRawTexture {
rect,
texture: texture.clone(),
})
});
}

pub fn draw_rect<S, T>(&mut self, rect: Rect, stroke: S, fill: T)
Expand All @@ -438,7 +438,7 @@ impl Painter {
source,
stroke: stroke.into(),
fill: fill.into(),
})
});
}

pub fn draw_sprite(
Expand Down Expand Up @@ -470,7 +470,7 @@ impl Painter {
top: margin.top / h as f32,
bottom: margin.bottom / h as f32,
}),
})
});
}

#[allow(dead_code)]
Expand All @@ -497,7 +497,7 @@ impl Painter {
p2,
source,
color: color.into(),
})
});
}

pub fn draw_line<T: Into<Color>>(&mut self, start: Vec2, end: Vec2, color: T) {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/widgets/checkbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,6 @@ impl<'a> Checkbox<'a> {

impl Ui {
pub fn checkbox(&mut self, id: Id, label: &str, data: &mut bool) {
Checkbox::new(id).label(label).ui(self, data)
Checkbox::new(id).label(label).ui(self, data);
}
}
2 changes: 1 addition & 1 deletion src/ui/widgets/combobox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl<'a, 'b, 'c> ComboBox<'a, 'b, 'c> {
&context.style.label_style,
pos,
vec2(combobox_area_w, size.y),
&UiContent::Label((&*self.variants[*data]).into()),
&UiContent::Label(self.variants[*data].into()),
ElementState {
focused: context.focused,
hovered,
Expand Down
2 changes: 1 addition & 1 deletion src/ui/widgets/drag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,6 @@ impl Ui {
) {
let range = range.into();

Drag::new(id).label(label).range(range).ui(self, data)
Drag::new(id).label(label).range(range).ui(self, data);
}
}
2 changes: 1 addition & 1 deletion src/ui/widgets/editbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ impl<'a> Editbox<'a> {
character,
pos + vec2(x, y + font_size as f32 - baseline),
text_color,
&mut *font,
&mut font,
font_size,
)
.unwrap_or(0.);
Expand Down
9 changes: 5 additions & 4 deletions src/ui/widgets/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@ impl<'a> InputText<'a> {
}

if self.numbers {
editbox = editbox
.filter(&|character| character.is_digit(10) || character == '.' || character == '-')
editbox = editbox.filter(&|character| {
character.is_digit(10) || character == '.' || character == '-'
});
}
editbox.ui(ui, data);

Expand All @@ -132,13 +133,13 @@ impl<'a> InputText<'a> {

impl Ui {
pub fn input_text(&mut self, id: Id, label: &str, data: &mut String) {
InputText::new(id).label(label).ui(self, data)
InputText::new(id).label(label).ui(self, data);
}

pub fn input_password(&mut self, id: Id, label: &str, data: &mut String) {
InputText::new(id)
.label(label)
.password(true)
.ui(self, data)
.ui(self, data);
}
}
2 changes: 1 addition & 1 deletion src/ui/widgets/label.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl<'a> Label<'a> {

impl Ui {
pub fn label<P: Into<Option<Vec2>>>(&mut self, position: P, label: &str) {
Label::new(label).position(position).ui(self)
Label::new(label).position(position).ui(self);
}

pub fn calc_size(&mut self, label: &str) -> Vec2 {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/widgets/popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ impl Popup {

impl Ui {
pub fn popup<F: FnOnce(&mut Ui)>(&mut self, id: Id, size: Vec2, f: F) {
Popup::new(id, size).ui(self, f)
Popup::new(id, size).ui(self, f);
}
}
2 changes: 1 addition & 1 deletion src/ui/widgets/slider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,6 @@ impl<'a> Slider<'a> {

impl Ui {
pub fn slider(&mut self, id: Id, label: &str, range: Range<f32>, data: &mut f32) {
Slider::new(id, range).label(label).ui(self, data)
Slider::new(id, range).label(label).ui(self, data);
}
}
2 changes: 1 addition & 1 deletion src/ui/widgets/tree_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl<'a> TreeNode<'a> {
context.window.painter.draw_element_label(
&context.style.label_style,
pos + vec2(10., 0.),
&*self.label,
&self.label,
ElementState {
focused: context.focused,
..Default::default()
Expand Down

0 comments on commit 1094e74

Please sign in to comment.