mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-26 21:08:40 +00:00
Fix various clippy nits
This commit is contained in:
parent
2b72a2a62c
commit
9618683b99
@ -151,7 +151,7 @@ extern "C" fn resize_callback(data: *mut sys::ImGuiInputTextCallbackData) -> c_i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
14
src/lib.rs
14
src/lib.rs
@ -109,7 +109,7 @@ pub struct Ui<'ui> {
|
|||||||
font_atlas: Option<cell::RefMut<'ui, SharedFontAtlas>>,
|
font_atlas: Option<cell::RefMut<'ui, SharedFontAtlas>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
static FMT: &'static [u8] = b"%s\0";
|
static FMT: &[u8] = b"%s\0";
|
||||||
|
|
||||||
fn fmt_ptr() -> *const c_char {
|
fn fmt_ptr() -> *const c_char {
|
||||||
FMT.as_ptr() as *const c_char
|
FMT.as_ptr() as *const c_char
|
||||||
@ -240,7 +240,7 @@ impl<'ui> Ui<'ui> {
|
|||||||
buf: &'p mut ImString,
|
buf: &'p mut ImString,
|
||||||
size: [f32; 2],
|
size: [f32; 2],
|
||||||
) -> InputTextMultiline<'ui, 'p> {
|
) -> InputTextMultiline<'ui, 'p> {
|
||||||
InputTextMultiline::new(self, label, buf, size.into())
|
InputTextMultiline::new(self, label, buf, size)
|
||||||
}
|
}
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn input_float<'p>(&self, label: &'p ImStr, value: &'p mut f32) -> InputFloat<'ui, 'p> {
|
pub fn input_float<'p>(&self, label: &'p ImStr, value: &'p mut f32) -> InputFloat<'ui, 'p> {
|
||||||
@ -382,8 +382,6 @@ impl<'ui> Ui<'ui> {
|
|||||||
/// });
|
/// });
|
||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
/// # fn main() {
|
|
||||||
/// # }
|
|
||||||
/// ```
|
/// ```
|
||||||
pub fn tooltip<F: FnOnce()>(&self, f: F) {
|
pub fn tooltip<F: FnOnce()>(&self, f: F) {
|
||||||
unsafe { sys::igBeginTooltip() };
|
unsafe { sys::igBeginTooltip() };
|
||||||
@ -404,8 +402,6 @@ impl<'ui> Ui<'ui> {
|
|||||||
/// ui.tooltip_text("I'm a tooltip!");
|
/// ui.tooltip_text("I'm a tooltip!");
|
||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
/// # fn main() {
|
|
||||||
/// # }
|
|
||||||
/// ```
|
/// ```
|
||||||
pub fn tooltip_text<T: AsRef<str>>(&self, text: T) {
|
pub fn tooltip_text<T: AsRef<str>>(&self, text: T) {
|
||||||
self.tooltip(|| self.text(text));
|
self.tooltip(|| self.text(text));
|
||||||
@ -465,10 +461,8 @@ impl<'ui> Ui<'ui> {
|
|||||||
items: &'p [&'p StringType],
|
items: &'p [&'p StringType],
|
||||||
height_in_items: i32,
|
height_in_items: i32,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
let items_inner: Vec<*const c_char> = items
|
let items_inner: Vec<*const c_char> =
|
||||||
.into_iter()
|
items.iter().map(|item| item.as_ref().as_ptr()).collect();
|
||||||
.map(|item| item.as_ref().as_ptr())
|
|
||||||
.collect();
|
|
||||||
unsafe {
|
unsafe {
|
||||||
sys::igListBoxStr_arr(
|
sys::igListBoxStr_arr(
|
||||||
label.as_ptr(),
|
label.as_ptr(),
|
||||||
|
|||||||
@ -190,7 +190,7 @@ pub struct ImStr(CStr);
|
|||||||
|
|
||||||
impl<'a> Default for &'a ImStr {
|
impl<'a> Default for &'a ImStr {
|
||||||
fn default() -> &'a ImStr {
|
fn default() -> &'a ImStr {
|
||||||
static SLICE: &'static [u8] = &[0];
|
static SLICE: &[u8] = &[0];
|
||||||
unsafe { ImStr::from_utf8_with_nul_unchecked(SLICE) }
|
unsafe { ImStr::from_utf8_with_nul_unchecked(SLICE) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,7 @@ use crate::string::ImStr;
|
|||||||
use crate::style::StyleColor;
|
use crate::style::StyleColor;
|
||||||
use crate::Ui;
|
use crate::Ui;
|
||||||
|
|
||||||
static FMT: &'static [u8] = b"%s\0";
|
static FMT: &[u8] = b"%s\0";
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn fmt_ptr() -> *const c_char {
|
fn fmt_ptr() -> *const c_char {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user