mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-12 05:58:35 +00:00
Fix some (nightly-only) clippy lints where they make sense
This commit is contained in:
parent
a475ff90e9
commit
5be6045cf2
@ -36,6 +36,8 @@ fn test_mouse_button_variants() {
|
||||
/// Mouse cursor type identifier
|
||||
#[repr(i32)]
|
||||
#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]
|
||||
#[allow(unknown_lints)] // Fixme: remove once `clippy::upper_case_acronyms` is stable
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
pub enum MouseCursor {
|
||||
Arrow = sys::ImGuiMouseCursor_Arrow,
|
||||
/// Automatically used when hovering over text inputs, etc.
|
||||
@ -58,6 +60,7 @@ pub enum MouseCursor {
|
||||
NotAllowed = sys::ImGuiMouseCursor_NotAllowed,
|
||||
}
|
||||
|
||||
|
||||
impl MouseCursor {
|
||||
/// All possible `MouseCursor` varirants
|
||||
pub const VARIANTS: [MouseCursor; MouseCursor::COUNT] = [
|
||||
|
||||
@ -272,7 +272,7 @@ impl<'ui> Ui<'ui> {
|
||||
/// the right side)
|
||||
pub fn push_item_width(&self, item_width: f32) -> ItemWidthStackToken {
|
||||
unsafe { sys::igPushItemWidth(item_width) };
|
||||
ItemWidthStackToken { ctx: self.ctx }
|
||||
ItemWidthStackToken { _ctx: self.ctx }
|
||||
}
|
||||
/// Sets the width of the next item.
|
||||
///
|
||||
@ -298,7 +298,7 @@ impl<'ui> Ui<'ui> {
|
||||
/// - `< 0.0`: no wrapping
|
||||
pub fn push_text_wrap_pos(&self, wrap_pos_x: f32) -> TextWrapPosStackToken {
|
||||
unsafe { sys::igPushTextWrapPos(wrap_pos_x) };
|
||||
TextWrapPosStackToken { ctx: self.ctx }
|
||||
TextWrapPosStackToken { _ctx: self.ctx }
|
||||
}
|
||||
/// Changes an item flag by pushing a change to the item flag stack.
|
||||
///
|
||||
@ -311,7 +311,7 @@ impl<'ui> Ui<'ui> {
|
||||
}
|
||||
ItemFlagsStackToken {
|
||||
discriminant: mem::discriminant(&item_flag),
|
||||
ctx: self.ctx,
|
||||
_ctx: self.ctx,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -325,26 +325,26 @@ pub enum ItemFlag {
|
||||
|
||||
/// Tracks a change pushed to the item width stack
|
||||
pub struct ItemWidthStackToken {
|
||||
ctx: *const Context,
|
||||
_ctx: *const Context,
|
||||
}
|
||||
|
||||
impl ItemWidthStackToken {
|
||||
/// Pops a change from the item width stack
|
||||
pub fn pop(mut self, _: &Ui) {
|
||||
self.ctx = ptr::null();
|
||||
self._ctx = ptr::null();
|
||||
unsafe { sys::igPopItemWidth() };
|
||||
}
|
||||
}
|
||||
|
||||
/// Tracks a change pushed to the text wrap position stack
|
||||
pub struct TextWrapPosStackToken {
|
||||
ctx: *const Context,
|
||||
_ctx: *const Context,
|
||||
}
|
||||
|
||||
impl TextWrapPosStackToken {
|
||||
/// Pops a change from the text wrap position stack
|
||||
pub fn pop(mut self, _: &Ui) {
|
||||
self.ctx = ptr::null();
|
||||
self._ctx = ptr::null();
|
||||
unsafe { sys::igPopTextWrapPos() };
|
||||
}
|
||||
}
|
||||
@ -352,13 +352,13 @@ impl TextWrapPosStackToken {
|
||||
/// Tracks a change pushed to the item flags stack
|
||||
pub struct ItemFlagsStackToken {
|
||||
discriminant: mem::Discriminant<ItemFlag>,
|
||||
ctx: *const Context,
|
||||
_ctx: *const Context,
|
||||
}
|
||||
|
||||
impl ItemFlagsStackToken {
|
||||
/// Pops a change from the item flags stack
|
||||
pub fn pop(mut self, _: &Ui) {
|
||||
self.ctx = ptr::null();
|
||||
self._ctx = ptr::null();
|
||||
const ALLOW_KEYBOARD_FOCUS: ItemFlag = ItemFlag::AllowKeyboardFocus(true);
|
||||
const BUTTON_REPEAT: ItemFlag = ItemFlag::ButtonRepeat(true);
|
||||
|
||||
|
||||
@ -25,12 +25,14 @@ impl<'a> EditableColor<'a> {
|
||||
}
|
||||
|
||||
impl<'a> From<&'a mut [f32; 3]> for EditableColor<'a> {
|
||||
#[inline]
|
||||
fn from(value: &'a mut [f32; 3]) -> EditableColor<'a> {
|
||||
EditableColor::Float3(value)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a mut [f32; 4]> for EditableColor<'a> {
|
||||
#[inline]
|
||||
fn from(value: &'a mut [f32; 4]) -> EditableColor<'a> {
|
||||
EditableColor::Float4(value)
|
||||
}
|
||||
@ -40,22 +42,41 @@ impl<'a> From<&'a mut [f32; 4]> for EditableColor<'a> {
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
pub enum ColorEditInputMode {
|
||||
/// Edit as RGB(A).
|
||||
RGB,
|
||||
Rgb,
|
||||
/// Edit as HSV(A).
|
||||
HSV,
|
||||
Hsv,
|
||||
}
|
||||
|
||||
impl ColorEditInputMode {
|
||||
// Note: Probably no point in deprecating these since they're ~0 maintance burden.
|
||||
/// Edit as RGB(A). Alias for [`Self::Rgb`] for backwards-compatibility.
|
||||
pub const RGB: Self = Self::Rgb;
|
||||
/// Edit as HSV(A). Alias for [`Self::Hsv`] for backwards-compatibility.
|
||||
pub const HSV: Self = Self::Hsv;
|
||||
}
|
||||
|
||||
/// Color editor display mode.
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
pub enum ColorEditDisplayMode {
|
||||
/// Display as RGB(A).
|
||||
RGB,
|
||||
Rgb,
|
||||
/// Display as HSV(A).
|
||||
HSV,
|
||||
/// Display as hex (e.g. #AABBCC(DD))
|
||||
HEX,
|
||||
Hsv,
|
||||
/// Display as hex (e.g. `#AABBCC(DD)`)
|
||||
Hex,
|
||||
}
|
||||
|
||||
impl ColorEditDisplayMode {
|
||||
// Note: Probably no point in deprecating these since they're ~0 maintance burden.
|
||||
/// Display as RGB(A). Alias for [`Self::Rgb`] for backwards-compatibility.
|
||||
pub const RGB: Self = Self::Rgb;
|
||||
/// Display as HSV(A). Alias for [`Self::Hsv`] for backwards-compatibility.
|
||||
pub const HSV: Self = Self::Hsv;
|
||||
/// Display as hex. Alias for [`Self::Hex`] for backwards-compatibility.
|
||||
pub const HEX: Self = Self::Hex;
|
||||
}
|
||||
|
||||
|
||||
/// Color picker hue/saturation/value editor mode
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
pub enum ColorPickerMode {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user