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