mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-13 22:48:34 +00:00
fix lint errors and ensure examples actually are linted
This commit is contained in:
parent
f375007f26
commit
e585291e4d
26
.github/workflows/ci.yml
vendored
26
.github/workflows/ci.yml
vendored
@ -9,8 +9,10 @@ on:
|
||||
|
||||
jobs:
|
||||
clippy:
|
||||
name: Run clippy / linting
|
||||
name: Run linter
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
RUSTFLAGS: -D warnings
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
@ -23,18 +25,17 @@ jobs:
|
||||
- uses: hecrj/setup-rust-action@v1
|
||||
with:
|
||||
components: clippy
|
||||
- run: cargo clippy --workspace
|
||||
- run: cargo clippy --workspace --all-targets
|
||||
# excluded crates
|
||||
- run: cargo clippy --manifest-path imgui-examples/Cargo.toml
|
||||
- run: cargo clippy --manifest-path imgui-gfx-examples/Cargo.toml
|
||||
- run: cargo clippy --manifest-path imgui-sys-bindgen/Cargo.toml
|
||||
- run: cargo clippy --manifest-path imgui-examples/Cargo.toml --all-targets
|
||||
- run: cargo clippy --manifest-path imgui-gfx-examples/Cargo.toml --all-targets
|
||||
- run: cargo clippy --manifest-path imgui-sys-bindgen/Cargo.toml --all-targets
|
||||
# supported winit versions
|
||||
- run: cargo clippy --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-19
|
||||
- run: cargo clippy --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-20
|
||||
- run: cargo clippy --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-22
|
||||
- run: cargo clippy --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-23
|
||||
# Ensure we compile with all features
|
||||
- run: cargo check --manifest-path imgui-winit-support/Cargo.toml --all-features
|
||||
- run: cargo clippy --manifest-path imgui-winit-support/Cargo.toml --all-features --all-targets
|
||||
- run: cargo clippy --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-19 --all-targets
|
||||
- run: cargo clippy --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-20 --all-targets
|
||||
- run: cargo clippy --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-22 --all-targets
|
||||
- run: cargo clippy --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-23 --all-targets
|
||||
|
||||
rustfmt:
|
||||
name: Check rustfmt
|
||||
@ -62,6 +63,9 @@ jobs:
|
||||
test:
|
||||
name: Run tests
|
||||
runs-on: ${{ matrix.os }}
|
||||
env:
|
||||
RUSTFLAGS: -D warnings
|
||||
RUST_BACKTRACE: 1
|
||||
strategy:
|
||||
matrix:
|
||||
rust:
|
||||
|
||||
@ -6,7 +6,7 @@ pub struct ClipboardSupport(ClipboardContext);
|
||||
pub fn init() -> Option<ClipboardSupport> {
|
||||
ClipboardContext::new()
|
||||
.ok()
|
||||
.map(|ctx| ClipboardSupport(ctx))
|
||||
.map(ClipboardSupport)
|
||||
}
|
||||
|
||||
impl ClipboardBackend for ClipboardSupport {
|
||||
|
||||
@ -82,11 +82,11 @@ impl Default for State {
|
||||
no_menu: false,
|
||||
no_close: false,
|
||||
wrap_width: 200.0,
|
||||
buf: buf,
|
||||
buf,
|
||||
item: 0,
|
||||
item2: 0,
|
||||
text: text,
|
||||
text_multiline: text_multiline,
|
||||
text,
|
||||
text_multiline,
|
||||
i0: 123,
|
||||
f0: 0.001,
|
||||
vec2f: [0.10, 0.20],
|
||||
@ -870,9 +870,7 @@ fn show_example_menu_file<'a>(ui: &Ui<'a>, state: &mut FileMenuState) {
|
||||
}
|
||||
menu.end(ui);
|
||||
}
|
||||
if let Some(_) = ui.begin_menu(im_str!("Disabled"), false) {
|
||||
unreachable!();
|
||||
}
|
||||
assert!(ui.begin_menu(im_str!("Disabled"), false).is_none());
|
||||
MenuItem::new(im_str!("Checked")).selected(true).build(ui);
|
||||
MenuItem::new(im_str!("Quit"))
|
||||
.shortcut(im_str!("Alt+F4"))
|
||||
|
||||
1
imgui-gfx-examples/Cargo.lock
generated
1
imgui-gfx-examples/Cargo.lock
generated
@ -536,7 +536,6 @@ dependencies = [
|
||||
"bitflags",
|
||||
"gfx",
|
||||
"imgui-sys",
|
||||
"lazy_static",
|
||||
"parking_lot 0.11.0",
|
||||
]
|
||||
|
||||
|
||||
@ -77,16 +77,17 @@ mod hlsl_build {
|
||||
let mut code: *mut ID3DBlob = ptr::null_mut();
|
||||
let mut error_msgs: *mut ID3DBlob = ptr::null_mut();
|
||||
|
||||
let c_entry_point = CString::new(entry_point).unwrap();
|
||||
let c_target = CString::new(target).unwrap();
|
||||
let c_source_path = CString::new(source_path.to_string_lossy().to_string()).unwrap();
|
||||
let hr = d3dcompiler::D3DCompile(
|
||||
src_data.as_bytes().as_ptr() as LPCVOID,
|
||||
src_data.as_bytes().len(),
|
||||
CString::new(source_path.to_string_lossy().to_string())
|
||||
.unwrap()
|
||||
.as_ptr(),
|
||||
c_source_path.as_ptr(),
|
||||
ptr::null(),
|
||||
ptr::null_mut(),
|
||||
CString::new(entry_point).unwrap().as_ptr(),
|
||||
CString::new(target).unwrap().as_ptr(),
|
||||
c_entry_point.as_ptr(),
|
||||
c_target.as_ptr(),
|
||||
0,
|
||||
0,
|
||||
&mut code,
|
||||
|
||||
@ -17,7 +17,7 @@ fn main() {
|
||||
|
||||
let wasm_ffi_import_name = option_env!("IMGUI_RS_WASM_IMPORT_NAME")
|
||||
.map(|s| s.to_string())
|
||||
.or(Some("imgui-sys-v0".to_string()));
|
||||
.or_else(|| Some("imgui-sys-v0".to_string()));
|
||||
|
||||
let wasm_bindings = generate_bindings(&sys_path.join("third-party"), wasm_ffi_import_name)
|
||||
.expect("Failed to generate bindings");
|
||||
|
||||
@ -248,6 +248,7 @@ struct Button {
|
||||
impl Button {
|
||||
// we can use this in an array initializer, unlike `Default::default()` or a
|
||||
// `const fn new()`.
|
||||
#[allow(clippy::declare_interior_mutable_const)]
|
||||
const INIT: Button = Self {
|
||||
pressed_this_frame: Cell::new(false),
|
||||
state: Cell::new(false),
|
||||
|
||||
@ -342,10 +342,10 @@ impl<'ui> Ui<'ui> {
|
||||
|
||||
// Widgets: Popups
|
||||
impl<'ui> Ui<'ui> {
|
||||
pub fn open_popup<'p>(&self, str_id: &'p ImStr) {
|
||||
pub fn open_popup(&self, str_id: &ImStr) {
|
||||
unsafe { sys::igOpenPopup(str_id.as_ptr(), 0) };
|
||||
}
|
||||
pub fn popup<'p, F>(&self, str_id: &'p ImStr, f: F)
|
||||
pub fn popup<F>(&self, str_id: &ImStr, f: F)
|
||||
where
|
||||
F: FnOnce(),
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user