mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-11 13:38:35 +00:00
Fix several clippy nits
This commit is contained in:
parent
83c2503134
commit
e142f5d1b5
@ -78,8 +78,8 @@ pub enum FocusedWidget {
|
||||
}
|
||||
|
||||
impl FocusedWidget {
|
||||
fn as_offset(&self) -> i32 {
|
||||
match *self {
|
||||
fn as_offset(self) -> i32 {
|
||||
match self {
|
||||
FocusedWidget::Previous => -1,
|
||||
FocusedWidget::Next => 0,
|
||||
FocusedWidget::Offset(offset) => offset as i32,
|
||||
|
||||
@ -169,7 +169,9 @@ impl<'a> Iterator for DrawCmdIterator<'a> {
|
||||
idx_offset: cmd.IdxOffset as usize,
|
||||
};
|
||||
match cmd.UserCallback {
|
||||
Some(raw_callback) if raw_callback as isize == -1 => DrawCmd::ResetRenderState,
|
||||
Some(raw_callback) if raw_callback as usize == -1isize as usize => {
|
||||
DrawCmd::ResetRenderState
|
||||
}
|
||||
Some(raw_callback) => DrawCmd::RawCallback {
|
||||
callback: raw_callback,
|
||||
raw_cmd: cmd,
|
||||
|
||||
@ -115,7 +115,7 @@ impl ImageButton {
|
||||
/// - `= 0`: no framing
|
||||
/// - `> 0`: set framing size
|
||||
pub fn frame_padding(mut self, frame_padding: i32) -> Self {
|
||||
self.frame_padding = frame_padding.into();
|
||||
self.frame_padding = frame_padding;
|
||||
self
|
||||
}
|
||||
/// Sets the background color (default: no background color)
|
||||
|
||||
@ -10,28 +10,31 @@ impl<'ui> Ui<'ui> {
|
||||
/// Creates and starts appending to a full-screen menu bar.
|
||||
///
|
||||
/// Returns `None` if the menu bar is not visible and no content should be rendered.
|
||||
pub fn main_menu_bar<'a>(&'a self) -> Option<MainMenuBarToken<'a>> {
|
||||
match unsafe { sys::igBeginMainMenuBar() } {
|
||||
true => Some(MainMenuBarToken { _ui: PhantomData }),
|
||||
false => None,
|
||||
pub fn main_menu_bar(&self) -> Option<MainMenuBarToken> {
|
||||
if unsafe { sys::igBeginMainMenuBar() } {
|
||||
Some(MainMenuBarToken { _ui: PhantomData })
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
/// Creates and starts appending to the menu bar of the current window.
|
||||
///
|
||||
/// Returns `None` if the menu bar is not visible and no content should be rendered.
|
||||
pub fn menu_bar<'a>(&'a self) -> Option<MenuBarToken<'a>> {
|
||||
match unsafe { sys::igBeginMenuBar() } {
|
||||
true => Some(MenuBarToken { _ui: PhantomData }),
|
||||
false => None,
|
||||
pub fn menu_bar(&self) -> Option<MenuBarToken> {
|
||||
if unsafe { sys::igBeginMenuBar() } {
|
||||
Some(MenuBarToken { _ui: PhantomData })
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
/// Creates and starts appending to a sub-menu entry.
|
||||
///
|
||||
/// Returns `None` if the menu is not visible and no content should be rendered.
|
||||
pub fn menu<'a>(&'a self, label: &ImStr, enabled: bool) -> Option<MenuToken<'a>> {
|
||||
match unsafe { sys::igBeginMenu(label.as_ptr(), enabled) } {
|
||||
true => Some(MenuToken { _ui: PhantomData }),
|
||||
false => None,
|
||||
pub fn menu(&self, label: &ImStr, enabled: bool) -> Option<MenuToken> {
|
||||
if unsafe { sys::igBeginMenu(label.as_ptr(), enabled) } {
|
||||
Some(MenuToken { _ui: PhantomData })
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ impl<'a> ProgressBar<'a> {
|
||||
/// bar choose a size, and positive values will use the given size.
|
||||
#[inline]
|
||||
pub fn size(mut self, size: [f32; 2]) -> Self {
|
||||
self.size = size.into();
|
||||
self.size = size;
|
||||
self
|
||||
}
|
||||
/// Builds the progress bar
|
||||
|
||||
@ -98,7 +98,7 @@ impl<'a> Selectable<'a> {
|
||||
/// - `= 0.0`: use label height
|
||||
#[inline]
|
||||
pub fn size(mut self, size: [f32; 2]) -> Self {
|
||||
self.size = size.into();
|
||||
self.size = size;
|
||||
self
|
||||
}
|
||||
/// Builds the selectable.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user