mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-26 21:08:40 +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
|
/// Mouse cursor type identifier
|
||||||
#[repr(i32)]
|
#[repr(i32)]
|
||||||
#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]
|
#[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 {
|
pub enum MouseCursor {
|
||||||
Arrow = sys::ImGuiMouseCursor_Arrow,
|
Arrow = sys::ImGuiMouseCursor_Arrow,
|
||||||
/// Automatically used when hovering over text inputs, etc.
|
/// Automatically used when hovering over text inputs, etc.
|
||||||
@ -58,6 +60,7 @@ pub enum MouseCursor {
|
|||||||
NotAllowed = sys::ImGuiMouseCursor_NotAllowed,
|
NotAllowed = sys::ImGuiMouseCursor_NotAllowed,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl MouseCursor {
|
impl MouseCursor {
|
||||||
/// All possible `MouseCursor` varirants
|
/// All possible `MouseCursor` varirants
|
||||||
pub const VARIANTS: [MouseCursor; MouseCursor::COUNT] = [
|
pub const VARIANTS: [MouseCursor; MouseCursor::COUNT] = [
|
||||||
|
|||||||
@ -272,7 +272,7 @@ impl<'ui> Ui<'ui> {
|
|||||||
/// the right side)
|
/// the right side)
|
||||||
pub fn push_item_width(&self, item_width: f32) -> ItemWidthStackToken {
|
pub fn push_item_width(&self, item_width: f32) -> ItemWidthStackToken {
|
||||||
unsafe { sys::igPushItemWidth(item_width) };
|
unsafe { sys::igPushItemWidth(item_width) };
|
||||||
ItemWidthStackToken { ctx: self.ctx }
|
ItemWidthStackToken { _ctx: self.ctx }
|
||||||
}
|
}
|
||||||
/// Sets the width of the next item.
|
/// Sets the width of the next item.
|
||||||
///
|
///
|
||||||
@ -298,7 +298,7 @@ impl<'ui> Ui<'ui> {
|
|||||||
/// - `< 0.0`: no wrapping
|
/// - `< 0.0`: no wrapping
|
||||||
pub fn push_text_wrap_pos(&self, wrap_pos_x: f32) -> TextWrapPosStackToken {
|
pub fn push_text_wrap_pos(&self, wrap_pos_x: f32) -> TextWrapPosStackToken {
|
||||||
unsafe { sys::igPushTextWrapPos(wrap_pos_x) };
|
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.
|
/// Changes an item flag by pushing a change to the item flag stack.
|
||||||
///
|
///
|
||||||
@ -311,7 +311,7 @@ impl<'ui> Ui<'ui> {
|
|||||||
}
|
}
|
||||||
ItemFlagsStackToken {
|
ItemFlagsStackToken {
|
||||||
discriminant: mem::discriminant(&item_flag),
|
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
|
/// Tracks a change pushed to the item width stack
|
||||||
pub struct ItemWidthStackToken {
|
pub struct ItemWidthStackToken {
|
||||||
ctx: *const Context,
|
_ctx: *const Context,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ItemWidthStackToken {
|
impl ItemWidthStackToken {
|
||||||
/// Pops a change from the item width stack
|
/// Pops a change from the item width stack
|
||||||
pub fn pop(mut self, _: &Ui) {
|
pub fn pop(mut self, _: &Ui) {
|
||||||
self.ctx = ptr::null();
|
self._ctx = ptr::null();
|
||||||
unsafe { sys::igPopItemWidth() };
|
unsafe { sys::igPopItemWidth() };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Tracks a change pushed to the text wrap position stack
|
/// Tracks a change pushed to the text wrap position stack
|
||||||
pub struct TextWrapPosStackToken {
|
pub struct TextWrapPosStackToken {
|
||||||
ctx: *const Context,
|
_ctx: *const Context,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TextWrapPosStackToken {
|
impl TextWrapPosStackToken {
|
||||||
/// Pops a change from the text wrap position stack
|
/// Pops a change from the text wrap position stack
|
||||||
pub fn pop(mut self, _: &Ui) {
|
pub fn pop(mut self, _: &Ui) {
|
||||||
self.ctx = ptr::null();
|
self._ctx = ptr::null();
|
||||||
unsafe { sys::igPopTextWrapPos() };
|
unsafe { sys::igPopTextWrapPos() };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -352,13 +352,13 @@ impl TextWrapPosStackToken {
|
|||||||
/// Tracks a change pushed to the item flags stack
|
/// Tracks a change pushed to the item flags stack
|
||||||
pub struct ItemFlagsStackToken {
|
pub struct ItemFlagsStackToken {
|
||||||
discriminant: mem::Discriminant<ItemFlag>,
|
discriminant: mem::Discriminant<ItemFlag>,
|
||||||
ctx: *const Context,
|
_ctx: *const Context,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ItemFlagsStackToken {
|
impl ItemFlagsStackToken {
|
||||||
/// Pops a change from the item flags stack
|
/// Pops a change from the item flags stack
|
||||||
pub fn pop(mut self, _: &Ui) {
|
pub fn pop(mut self, _: &Ui) {
|
||||||
self.ctx = ptr::null();
|
self._ctx = ptr::null();
|
||||||
const ALLOW_KEYBOARD_FOCUS: ItemFlag = ItemFlag::AllowKeyboardFocus(true);
|
const ALLOW_KEYBOARD_FOCUS: ItemFlag = ItemFlag::AllowKeyboardFocus(true);
|
||||||
const BUTTON_REPEAT: ItemFlag = ItemFlag::ButtonRepeat(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> {
|
impl<'a> From<&'a mut [f32; 3]> for EditableColor<'a> {
|
||||||
|
#[inline]
|
||||||
fn from(value: &'a mut [f32; 3]) -> EditableColor<'a> {
|
fn from(value: &'a mut [f32; 3]) -> EditableColor<'a> {
|
||||||
EditableColor::Float3(value)
|
EditableColor::Float3(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> From<&'a mut [f32; 4]> for EditableColor<'a> {
|
impl<'a> From<&'a mut [f32; 4]> for EditableColor<'a> {
|
||||||
|
#[inline]
|
||||||
fn from(value: &'a mut [f32; 4]) -> EditableColor<'a> {
|
fn from(value: &'a mut [f32; 4]) -> EditableColor<'a> {
|
||||||
EditableColor::Float4(value)
|
EditableColor::Float4(value)
|
||||||
}
|
}
|
||||||
@ -40,22 +42,41 @@ impl<'a> From<&'a mut [f32; 4]> for EditableColor<'a> {
|
|||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||||
pub enum ColorEditInputMode {
|
pub enum ColorEditInputMode {
|
||||||
/// Edit as RGB(A).
|
/// Edit as RGB(A).
|
||||||
RGB,
|
Rgb,
|
||||||
/// Edit as HSV(A).
|
/// 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.
|
/// Color editor display mode.
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||||
pub enum ColorEditDisplayMode {
|
pub enum ColorEditDisplayMode {
|
||||||
/// Display as RGB(A).
|
/// Display as RGB(A).
|
||||||
RGB,
|
Rgb,
|
||||||
/// Display as HSV(A).
|
/// Display as HSV(A).
|
||||||
HSV,
|
Hsv,
|
||||||
/// Display as hex (e.g. #AABBCC(DD))
|
/// Display as hex (e.g. `#AABBCC(DD)`)
|
||||||
HEX,
|
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
|
/// Color picker hue/saturation/value editor mode
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||||
pub enum ColorPickerMode {
|
pub enum ColorPickerMode {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user