mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-25 20:38:36 +00:00
Fix clippy warnings
Mostly unnecessary 'as' casts to same kind, and unneeded borrows
This commit is contained in:
parent
3e995f481c
commit
b7fbd575c5
@ -480,7 +480,7 @@ impl Renderer {
|
|||||||
winit::event::WindowEvent::Moved(_) => unsafe {
|
winit::event::WindowEvent::Moved(_) => unsafe {
|
||||||
let new_pos = window.inner_position().unwrap().cast::<f32>();
|
let new_pos = window.inner_position().unwrap().cast::<f32>();
|
||||||
(*(viewport.platform_user_data.cast::<ViewportData>())).pos =
|
(*(viewport.platform_user_data.cast::<ViewportData>())).pos =
|
||||||
[new_pos.x as f32, new_pos.y as f32];
|
[new_pos.x, new_pos.y];
|
||||||
|
|
||||||
viewport.platform_request_move = true;
|
viewport.platform_request_move = true;
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1268,7 +1268,7 @@ extern "C" fn callback<T: InputTextCallbackHandler>(
|
|||||||
}
|
}
|
||||||
InputTextFlags::CALLBACK_HISTORY => {
|
InputTextFlags::CALLBACK_HISTORY => {
|
||||||
let key = unsafe {
|
let key = unsafe {
|
||||||
let key = (*data).EventKey as u32;
|
let key = (*data).EventKey;
|
||||||
match key {
|
match key {
|
||||||
sys::ImGuiKey_UpArrow => HistoryDirection::Up,
|
sys::ImGuiKey_UpArrow => HistoryDirection::Up,
|
||||||
sys::ImGuiKey_DownArrow => HistoryDirection::Down,
|
sys::ImGuiKey_DownArrow => HistoryDirection::Down,
|
||||||
|
|||||||
@ -376,7 +376,7 @@ impl IdStackToken<'_> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// # ID stack
|
/// # ID stack
|
||||||
impl<'ui> Ui {
|
impl Ui {
|
||||||
/// Pushes an identifier to the ID stack.
|
/// Pushes an identifier to the ID stack.
|
||||||
///
|
///
|
||||||
/// Returns an `IdStackToken` that can be popped by calling `.end()`
|
/// Returns an `IdStackToken` that can be popped by calling `.end()`
|
||||||
|
|||||||
@ -204,7 +204,7 @@ impl ImString {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Default for ImString {
|
impl Default for ImString {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn default() -> ImString {
|
fn default() -> ImString {
|
||||||
ImString(vec![b'\0'])
|
ImString(vec![b'\0'])
|
||||||
|
|||||||
@ -482,7 +482,7 @@ impl Ui {
|
|||||||
pub fn table_set_column_index(&self, column_index: usize) -> bool {
|
pub fn table_set_column_index(&self, column_index: usize) -> bool {
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
{
|
{
|
||||||
let size = self.table_column_count() as usize;
|
let size = self.table_column_count();
|
||||||
if column_index >= size {
|
if column_index >= size {
|
||||||
panic!(
|
panic!(
|
||||||
"column_index >= self.table_get_column_count().\
|
"column_index >= self.table_get_column_count().\
|
||||||
@ -760,7 +760,7 @@ pub struct TableColumnSetup<Name> {
|
|||||||
pub user_id: Id,
|
pub user_id: Id,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Name: AsRef<str>> TableColumnSetup<Name> {
|
impl<Name: AsRef<str>> TableColumnSetup<Name> {
|
||||||
pub fn new(name: Name) -> Self {
|
pub fn new(name: Name) -> Self {
|
||||||
Self {
|
Self {
|
||||||
name,
|
name,
|
||||||
|
|||||||
@ -2,7 +2,7 @@ use crate::sys;
|
|||||||
use crate::Ui;
|
use crate::Ui;
|
||||||
|
|
||||||
/// # Window scrolling
|
/// # Window scrolling
|
||||||
impl<'ui> Ui {
|
impl Ui {
|
||||||
/// Returns the horizontal scrolling position.
|
/// Returns the horizontal scrolling position.
|
||||||
///
|
///
|
||||||
/// Value is between 0.0 and self.scroll_max_x().
|
/// Value is between 0.0 and self.scroll_max_x().
|
||||||
|
|||||||
@ -131,22 +131,22 @@ fn generate_binding_file(
|
|||||||
"--use-core",
|
"--use-core",
|
||||||
];
|
];
|
||||||
cmd.args(a);
|
cmd.args(a);
|
||||||
cmd.args(&["--blocklist-type", "__darwin_size_t"]);
|
cmd.args(["--blocklist-type", "__darwin_size_t"]);
|
||||||
cmd.args(&["--raw-line", "#![allow(nonstandard_style, clippy::all)]"]);
|
cmd.args(["--raw-line", "#![allow(nonstandard_style, clippy::all)]"]);
|
||||||
cmd.arg("--output").arg(output);
|
cmd.arg("--output").arg(output);
|
||||||
cmd.args(&["--ctypes-prefix", "cty"]);
|
cmd.args(["--ctypes-prefix", "cty"]);
|
||||||
|
|
||||||
if let Some(name) = wasm_import_mod {
|
if let Some(name) = wasm_import_mod {
|
||||||
cmd.args(&["--wasm-import-module-name", name]);
|
cmd.args(["--wasm-import-module-name", name]);
|
||||||
}
|
}
|
||||||
for t in types {
|
for t in types {
|
||||||
cmd.args(&["--allowlist-type", t]);
|
cmd.args(["--allowlist-type", t]);
|
||||||
}
|
}
|
||||||
for f in funcs {
|
for f in funcs {
|
||||||
cmd.args(&["--allowlist-function", f]);
|
cmd.args(["--allowlist-function", f]);
|
||||||
}
|
}
|
||||||
cmd.arg(header);
|
cmd.arg(header);
|
||||||
cmd.args(&["--", "-DCIMGUI_DEFINE_ENUMS_AND_STRUCTS=1"]);
|
cmd.args(["--", "-DCIMGUI_DEFINE_ENUMS_AND_STRUCTS=1"]);
|
||||||
eprintln!("Executing bindgen [output = {}]", output.display());
|
eprintln!("Executing bindgen [output = {}]", output.display());
|
||||||
let status = cmd.status().context("Failed to execute bindgen")?;
|
let status = cmd.status().context("Failed to execute bindgen")?;
|
||||||
if !status.success() {
|
if !status.success() {
|
||||||
|
|||||||
@ -17,7 +17,7 @@ fn main() {
|
|||||||
|
|
||||||
fn try_main() -> Result<()> {
|
fn try_main() -> Result<()> {
|
||||||
let root = project_root();
|
let root = project_root();
|
||||||
let _d = xshell::pushd(&root)?;
|
let _d = xshell::pushd(root)?;
|
||||||
let flags = flags::Xtask::from_env()?;
|
let flags = flags::Xtask::from_env()?;
|
||||||
if flags.verbose {
|
if flags.verbose {
|
||||||
VERBOSE.store(true, std::sync::atomic::Ordering::Relaxed);
|
VERBOSE.store(true, std::sync::atomic::Ordering::Relaxed);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user