mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-11 21:48:36 +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>>,
|
||||
}
|
||||
|
||||
static FMT: &'static [u8] = b"%s\0";
|
||||
static FMT: &[u8] = b"%s\0";
|
||||
|
||||
fn fmt_ptr() -> *const c_char {
|
||||
FMT.as_ptr() as *const c_char
|
||||
@ -240,7 +240,7 @@ impl<'ui> Ui<'ui> {
|
||||
buf: &'p mut ImString,
|
||||
size: [f32; 2],
|
||||
) -> InputTextMultiline<'ui, 'p> {
|
||||
InputTextMultiline::new(self, label, buf, size.into())
|
||||
InputTextMultiline::new(self, label, buf, size)
|
||||
}
|
||||
#[must_use]
|
||||
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) {
|
||||
unsafe { sys::igBeginTooltip() };
|
||||
@ -404,8 +402,6 @@ impl<'ui> Ui<'ui> {
|
||||
/// ui.tooltip_text("I'm a tooltip!");
|
||||
/// }
|
||||
/// }
|
||||
/// # fn main() {
|
||||
/// # }
|
||||
/// ```
|
||||
pub fn tooltip_text<T: AsRef<str>>(&self, text: T) {
|
||||
self.tooltip(|| self.text(text));
|
||||
@ -465,10 +461,8 @@ impl<'ui> Ui<'ui> {
|
||||
items: &'p [&'p StringType],
|
||||
height_in_items: i32,
|
||||
) -> bool {
|
||||
let items_inner: Vec<*const c_char> = items
|
||||
.into_iter()
|
||||
.map(|item| item.as_ref().as_ptr())
|
||||
.collect();
|
||||
let items_inner: Vec<*const c_char> =
|
||||
items.iter().map(|item| item.as_ref().as_ptr()).collect();
|
||||
unsafe {
|
||||
sys::igListBoxStr_arr(
|
||||
label.as_ptr(),
|
||||
|
||||
@ -190,7 +190,7 @@ pub struct ImStr(CStr);
|
||||
|
||||
impl<'a> Default for &'a ImStr {
|
||||
fn default() -> &'a ImStr {
|
||||
static SLICE: &'static [u8] = &[0];
|
||||
static SLICE: &[u8] = &[0];
|
||||
unsafe { ImStr::from_utf8_with_nul_unchecked(SLICE) }
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ use crate::string::ImStr;
|
||||
use crate::style::StyleColor;
|
||||
use crate::Ui;
|
||||
|
||||
static FMT: &'static [u8] = b"%s\0";
|
||||
static FMT: &[u8] = b"%s\0";
|
||||
|
||||
#[inline]
|
||||
fn fmt_ptr() -> *const c_char {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user