Replace cargo-cranky with workspace lints (#4413)

Replace `cargo-cranky` (which has served us well) with workspace lints
This commit is contained in:
Emil Ernerfeldt 2024-04-25 17:24:50 +02:00 committed by GitHub
parent cee790681d
commit 2f508d6a61
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
82 changed files with 348 additions and 289 deletions

View File

@ -6,7 +6,7 @@ Please read the "Making a PR" section of [`CONTRIBUTING.md`](https://github.com/
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to `egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for maintainers to add commits to your PR.
* Remember to run `cargo fmt` and `cargo cranky`.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run `./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.

View File

@ -40,11 +40,6 @@ jobs:
- name: Lint vertical spacing
run: ./scripts/lint.py
- name: Install cargo-cranky
uses: baptiste0928/cargo-install@v1
with:
crate: cargo-cranky
- name: check --all-features
run: cargo check --locked --all-features --all-targets
@ -78,11 +73,11 @@ jobs:
- name: Test
run: cargo test --all-features
- name: Cranky
run: cargo cranky --all-targets --all-features -- -D warnings
- name: clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Cranky release
run: cargo cranky --all-targets --all-features --release -- -D warnings
- name: clippy release
run: cargo clippy --all-targets --all-features --release -- -D warnings
# ---------------------------------------------------------------------------
@ -101,11 +96,6 @@ jobs:
- name: Set up cargo cache
uses: Swatinem/rust-cache@v2
- name: Install cargo-cranky
uses: baptiste0928/cargo-install@v1
with:
crate: cargo-cranky
- name: Check wasm32 egui_demo_app
run: cargo check -p egui_demo_app --lib --target wasm32-unknown-unknown
@ -122,7 +112,7 @@ jobs:
- run: ./scripts/wasm_bindgen_check.sh --skip-setup
- name: Cranky wasm32
- name: clippy wasm32
run: ./scripts/clippy_wasm.sh
# ---------------------------------------------------------------------------

View File

@ -84,3 +84,169 @@ wgpu = { version = "0.19.1", default-features = false, features = [
"fragile-send-sync-non-atomic-wasm",
] }
winit = { version = "0.29.4", default-features = false }
[workspace.lints.rust]
unsafe_code = "deny"
elided_lifetimes_in_paths = "warn"
future_incompatible = "warn"
nonstandard_style = "warn"
rust_2018_idioms = "warn"
rust_2021_prelude_collisions = "warn"
semicolon_in_expressions_from_macros = "warn"
trivial_numeric_casts = "warn"
unsafe_op_in_unsafe_fn = "warn" # `unsafe_op_in_unsafe_fn` may become the default in future Rust versions: https://github.com/rust-lang/rust/issues/71668
unused_extern_crates = "warn"
unused_import_braces = "warn"
unused_lifetimes = "warn"
trivial_casts = "allow"
unused_qualifications = "allow"
[workspace.lints.rustdoc]
all = "warn"
missing_crate_level_docs = "warn"
# See also clippy.toml
[workspace.lints.clippy]
as_ptr_cast_mut = "warn"
await_holding_lock = "warn"
bool_to_int_with_if = "warn"
char_lit_as_u8 = "warn"
checked_conversions = "warn"
clear_with_drain = "warn"
cloned_instead_of_copied = "warn"
dbg_macro = "warn"
debug_assert_with_mut_call = "warn"
derive_partial_eq_without_eq = "warn"
disallowed_macros = "warn" # See clippy.toml
disallowed_methods = "warn" # See clippy.toml
disallowed_names = "warn" # See clippy.toml
disallowed_script_idents = "warn" # See clippy.toml
disallowed_types = "warn" # See clippy.toml
doc_link_with_quotes = "warn"
doc_markdown = "warn"
empty_enum = "warn"
enum_glob_use = "warn"
equatable_if_let = "warn"
exit = "warn"
expl_impl_clone_on_copy = "warn"
explicit_deref_methods = "warn"
explicit_into_iter_loop = "warn"
explicit_iter_loop = "warn"
fallible_impl_from = "warn"
filter_map_next = "warn"
flat_map_option = "warn"
float_cmp_const = "warn"
fn_params_excessive_bools = "warn"
fn_to_numeric_cast_any = "warn"
from_iter_instead_of_collect = "warn"
get_unwrap = "warn"
if_let_mutex = "warn"
implicit_clone = "warn"
implied_bounds_in_impls = "warn"
imprecise_flops = "warn"
index_refutable_slice = "warn"
inefficient_to_string = "warn"
infinite_loop = "warn"
into_iter_without_iter = "warn"
invalid_upcast_comparisons = "warn"
iter_not_returning_iterator = "warn"
iter_on_empty_collections = "warn"
iter_on_single_items = "warn"
iter_without_into_iter = "warn"
large_digit_groups = "warn"
large_include_file = "warn"
large_stack_arrays = "warn"
large_stack_frames = "warn"
large_types_passed_by_value = "warn"
let_unit_value = "warn"
linkedlist = "warn"
lossy_float_literal = "warn"
macro_use_imports = "warn"
manual_assert = "warn"
manual_clamp = "warn"
manual_instant_elapsed = "warn"
manual_let_else = "warn"
manual_ok_or = "warn"
manual_string_new = "warn"
map_err_ignore = "warn"
map_flatten = "warn"
map_unwrap_or = "warn"
match_on_vec_items = "warn"
match_same_arms = "warn"
match_wild_err_arm = "warn"
match_wildcard_for_single_variants = "warn"
mem_forget = "warn"
mismatched_target_os = "warn"
mismatching_type_param_order = "warn"
missing_enforced_import_renames = "warn"
missing_errors_doc = "warn"
missing_safety_doc = "warn"
mut_mut = "warn"
mutex_integer = "warn"
needless_borrow = "warn"
needless_continue = "warn"
needless_for_each = "warn"
needless_pass_by_ref_mut = "warn"
needless_pass_by_value = "warn"
negative_feature_names = "warn"
nonstandard_macro_braces = "warn"
option_option = "warn"
path_buf_push_overwrite = "warn"
ptr_as_ptr = "warn"
ptr_cast_constness = "warn"
pub_without_shorthand = "warn"
rc_mutex = "warn"
readonly_write_lock = "warn"
redundant_type_annotations = "warn"
ref_option_ref = "warn"
ref_patterns = "warn"
rest_pat_in_fully_bound_structs = "warn"
same_functions_in_if_condition = "warn"
semicolon_if_nothing_returned = "warn"
single_match_else = "warn"
str_to_string = "warn"
string_add = "warn"
string_add_assign = "warn"
string_lit_as_bytes = "warn"
string_lit_chars_any = "warn"
string_to_string = "warn"
suspicious_command_arg_space = "warn"
suspicious_xor_used_as_pow = "warn"
todo = "warn"
trailing_empty_array = "warn"
trait_duplication_in_bounds = "warn"
tuple_array_conversions = "warn"
unchecked_duration_subtraction = "warn"
undocumented_unsafe_blocks = "warn"
unimplemented = "warn"
uninhabited_references = "warn"
uninlined_format_args = "warn"
unnecessary_box_returns = "warn"
unnecessary_safety_doc = "warn"
unnecessary_struct_initialization = "warn"
unnecessary_wraps = "warn"
unnested_or_patterns = "warn"
unused_peekable = "warn"
unused_rounding = "warn"
unused_self = "warn"
useless_transmute = "warn"
verbose_file_reads = "warn"
wildcard_dependencies = "warn"
zero_sized_map_values = "warn"
# TODO(emilk): enable more of these linits:
iter_over_hash_type = "allow"
let_underscore_untyped = "allow"
missing_assert_message = "allow"
print_stderr = "allow" # TODO(emilk): use `log` crate insteaditer_over_hash_type = "allow"
should_panic_without_expect = "allow"
too_many_lines = "allow"
unwrap_used = "allow" # TODO(emilk): We really wanna warn on this one
manual_range_contains = "allow" # this one is just worse imho
self_named_module_files = "allow" # Disabled waiting on https://github.com/rust-lang/rust-clippy/issues/9602
significant_drop_tightening = "allow" # Too many false positives
wildcard_imports = "allow" # we do this a lot in egui

View File

@ -1,176 +0,0 @@
# https://github.com/ericseppanen/cargo-cranky
# cargo install cargo-cranky && cargo cranky
# See also clippy.toml
deny = ["unsafe_code"]
warn = [
"clippy::all",
"clippy::as_ptr_cast_mut",
"clippy::await_holding_lock",
"clippy::bool_to_int_with_if",
"clippy::branches_sharing_code",
"clippy::char_lit_as_u8",
"clippy::checked_conversions",
"clippy::clear_with_drain",
"clippy::cloned_instead_of_copied",
"clippy::dbg_macro",
"clippy::debug_assert_with_mut_call",
"clippy::default_union_representation",
"clippy::derive_partial_eq_without_eq",
"clippy::disallowed_macros", # See clippy.toml
"clippy::disallowed_methods", # See clippy.toml
"clippy::disallowed_names", # See clippy.toml
"clippy::disallowed_script_idents", # See clippy.toml
"clippy::disallowed_types", # See clippy.toml
"clippy::doc_link_with_quotes",
"clippy::doc_markdown",
"clippy::empty_enum",
"clippy::empty_line_after_outer_attr",
"clippy::enum_glob_use",
"clippy::equatable_if_let",
"clippy::exit",
"clippy::expl_impl_clone_on_copy",
"clippy::explicit_deref_methods",
"clippy::explicit_into_iter_loop",
"clippy::explicit_iter_loop",
"clippy::fallible_impl_from",
"clippy::filter_map_next",
"clippy::flat_map_option",
"clippy::float_cmp_const",
"clippy::fn_params_excessive_bools",
"clippy::fn_to_numeric_cast_any",
"clippy::from_iter_instead_of_collect",
"clippy::get_unwrap",
"clippy::if_let_mutex",
"clippy::implicit_clone",
"clippy::imprecise_flops",
"clippy::index_refutable_slice",
"clippy::inefficient_to_string",
"clippy::invalid_upcast_comparisons",
"clippy::iter_not_returning_iterator",
"clippy::iter_on_empty_collections",
"clippy::iter_on_single_items",
"clippy::large_digit_groups",
"clippy::large_include_file",
"clippy::large_stack_arrays",
"clippy::large_stack_frames",
"clippy::large_types_passed_by_value",
"clippy::let_unit_value",
"clippy::linkedlist",
"clippy::lossy_float_literal",
"clippy::macro_use_imports",
"clippy::manual_assert",
"clippy::manual_clamp",
"clippy::manual_instant_elapsed",
"clippy::manual_let_else",
"clippy::manual_ok_or",
"clippy::manual_string_new",
"clippy::map_err_ignore",
"clippy::map_flatten",
"clippy::map_unwrap_or",
"clippy::match_on_vec_items",
"clippy::match_same_arms",
"clippy::match_wild_err_arm",
"clippy::match_wildcard_for_single_variants",
"clippy::mem_forget",
"clippy::mismatched_target_os",
"clippy::mismatching_type_param_order",
"clippy::missing_enforced_import_renames",
"clippy::missing_errors_doc",
"clippy::missing_safety_doc",
"clippy::mut_mut",
"clippy::mutex_integer",
"clippy::needless_borrow",
"clippy::needless_continue",
"clippy::needless_for_each",
"clippy::needless_pass_by_value",
"clippy::negative_feature_names",
"clippy::nonstandard_macro_braces",
"clippy::option_option",
"clippy::path_buf_push_overwrite",
"clippy::print_stdout",
"clippy::ptr_as_ptr",
"clippy::ptr_cast_constness",
"clippy::pub_without_shorthand",
"clippy::rc_mutex",
"clippy::redundant_type_annotations",
"clippy::ref_option_ref",
"clippy::rest_pat_in_fully_bound_structs",
"clippy::same_functions_in_if_condition",
"clippy::semicolon_if_nothing_returned",
"clippy::significant_drop_tightening",
"clippy::single_match_else",
"clippy::str_to_string",
"clippy::string_add_assign",
"clippy::string_add",
"clippy::string_lit_as_bytes",
"clippy::string_to_string",
"clippy::suspicious_command_arg_space",
"clippy::suspicious_xor_used_as_pow",
"clippy::todo",
"clippy::trailing_empty_array",
"clippy::trait_duplication_in_bounds",
"clippy::transmute_ptr_to_ptr",
"clippy::tuple_array_conversions",
"clippy::unchecked_duration_subtraction",
"clippy::undocumented_unsafe_blocks",
"clippy::unimplemented",
"clippy::uninlined_format_args",
"clippy::unnecessary_box_returns",
"clippy::unnecessary_safety_comment",
"clippy::unnecessary_safety_doc",
"clippy::unnecessary_self_imports",
"clippy::unnecessary_struct_initialization",
"clippy::unnecessary_wraps",
"clippy::unnested_or_patterns",
"clippy::unused_peekable",
"clippy::unused_rounding",
"clippy::unused_self",
"clippy::use_self",
"clippy::useless_transmute",
"clippy::verbose_file_reads",
"clippy::wildcard_dependencies",
"clippy::wildcard_imports",
"clippy::zero_sized_map_values",
"elided_lifetimes_in_paths",
"future_incompatible",
"nonstandard_style",
"rust_2018_idioms",
"rust_2021_prelude_collisions",
"rustdoc::missing_crate_level_docs",
"semicolon_in_expressions_from_macros",
"trivial_numeric_casts",
"unsafe_op_in_unsafe_fn", # `unsafe_op_in_unsafe_fn` may become the default in future Rust versions: https://github.com/rust-lang/rust/issues/71668
"unused_extern_crates",
"unused_import_braces",
"unused_lifetimes",
# Enable when we update MSRV:
# "clippy::implied_bounds_in_impls",
# "clippy::needless_pass_by_ref_mut",
# "clippy::readonly_write_lock",
# "clippy::should_panic_without_expect",
# "clippy::string_lit_chars_any",
]
allow = [
"clippy::manual_range_contains", # this one is just worse imho
"clippy::significant_drop_tightening", # A lot of false positives
# TODO(emilk): enable more of these lints:
"clippy::cloned_instead_of_copied",
"clippy::let_underscore_untyped",
"clippy::missing_assert_message",
"clippy::missing_errors_doc",
"clippy::print_stderr", # TODO(emilk): use `log` crate instead
"clippy::self_named_module_files", # False positives
"clippy::too_many_lines",
"clippy::undocumented_unsafe_blocks",
"clippy::unwrap_used",
"clippy::useless_let_if_seq", # False positives
"clippy::wildcard_imports", # We do this a lot
"trivial_casts",
"unused_qualifications",
]

View File

@ -1,74 +0,0 @@
# This is a configuration file for the bacon tool
# More info at https://github.com/Canop/bacon
default_job = "cranky"
[jobs]
[jobs.cranky]
command = [
"cargo",
"cranky",
"--all-targets",
"--all-features",
"--color=always",
]
need_stdout = false
watch = ["tests", "benches", "examples"]
[jobs.wasm]
command = [
"cargo",
"cranky",
"-p=egui_demo_app",
"--lib",
"--target=wasm32-unknown-unknown",
"--target-dir=target_wasm",
"--all-features",
"--color=always",
]
need_stdout = false
watch = ["tests", "benches", "examples"]
[jobs.test]
command = ["cargo", "test", "--color=always"]
need_stdout = true
watch = ["tests"]
[jobs.doc]
command = ["cargo", "doc", "--color=always", "--all-features", "--no-deps"]
need_stdout = false
# if the doc compiles, then it opens in your browser and bacon switches
# to the previous job
[jobs.doc-open]
command = [
"cargo",
"doc",
"--color=always",
"--all-features",
"--no-deps",
"--open",
]
need_stdout = false
on_success = "back" # so that we don't open the browser at each change
# You can run your application and have the result displayed in bacon,
# *if* it makes sense for this crate. You can run an example the same
# way. Don't forget the `--color always` part or the errors won't be
# properly parsed.
[jobs.run]
command = ["cargo", "run", "--color=always"]
need_stdout = true
# You may define here keybindings that would be specific to
# a project, for example a shortcut to launch a specific job.
# Shortcuts to internal functions (scrolling, toggling, etc.)
# should go in your personal prefs.toml file instead.
[keybindings]
i = "job:initial"
c = "job:cranky"
a = "job:wasm"
d = "job:doc-open"
t = "job:test"
r = "job:run"

View File

@ -16,6 +16,9 @@ categories = ["mathematics", "encoding"]
keywords = ["gui", "color", "conversion", "gamedev", "images"]
include = ["../LICENSE-APACHE", "../LICENSE-MIT", "**/*.rs", "Cargo.toml"]
[lints]
workspace = true
[package.metadata.docs.rs]
all-features = true

View File

@ -24,6 +24,9 @@ all-features = true
rustc-args = ["--cfg=web_sys_unstable_apis"]
targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"]
[lints]
workspace = true
[lib]

View File

@ -224,6 +224,7 @@ fn set_title_and_icon_mac(title: &str, icon_data: Option<&IconData>) -> AppIconS
static NSApp: Option<&'static NSApplication>;
}
// SAFETY: we don't do anything dangerous here
unsafe {
let Some(app) = NSApp else {
log::debug!("NSApp is null");

View File

@ -5,7 +5,11 @@
//! There is a bunch of improvements we could do,
//! like removing a bunch of `unwraps`.
#![allow(clippy::arc_with_non_send_sync)] // glow::Context was accidentally non-Sync in glow 0.13, but that will be fixed in future releases of glow: https://github.com/grovesNL/glow/commit/c4a5f7151b9b4bbb380faa06ec27415235d1bf7e
// `clippy::arc_with_non_send_sync`: `glow::Context` was accidentally non-Sync in glow 0.13,
// but that will be fixed in future releases of glow.
// https://github.com/grovesNL/glow/commit/c4a5f7151b9b4bbb380faa06ec27415235d1bf7e
#![allow(clippy::arc_with_non_send_sync)]
#![allow(clippy::undocumented_unsafe_blocks)]
use std::{cell::RefCell, num::NonZeroU32, rc::Rc, sync::Arc, time::Instant};

View File

@ -119,7 +119,7 @@ pub fn install_text_agent(runner_ref: &WebRunner) -> Result<(), JsValue> {
}
/// Focus or blur text agent to toggle mobile keyboard.
pub fn update_text_agent(runner: &mut AppRunner) -> Option<()> {
pub fn update_text_agent(runner: &AppRunner) -> Option<()> {
use web_sys::HtmlInputElement;
let window = web_sys::window()?;
let document = window.document()?;

View File

@ -23,6 +23,9 @@ include = [
"Cargo.toml",
]
[lints]
workspace = true
[package.metadata.docs.rs]
all-features = true

View File

@ -1,3 +1,6 @@
#![allow(clippy::missing_errors_doc)]
#![allow(clippy::undocumented_unsafe_blocks)]
use std::{num::NonZeroU32, sync::Arc};
use egui::{ViewportId, ViewportIdMap, ViewportIdSet};

View File

@ -13,6 +13,9 @@ categories = ["gui", "game-development"]
keywords = ["winit", "egui", "gui", "gamedev"]
include = ["../LICENSE-APACHE", "../LICENSE-MIT", "**/*.rs", "Cargo.toml"]
[lints]
workspace = true
[package.metadata.docs.rs]
all-features = true

View File

@ -137,6 +137,8 @@ fn init_arboard() -> Option<arboard::Clipboard> {
fn init_smithay_clipboard(
raw_display_handle: Option<RawDisplayHandle>,
) -> Option<smithay_clipboard::Clipboard> {
#![allow(clippy::undocumented_unsafe_blocks)]
crate::profile_function!();
if let Some(RawDisplayHandle::Wayland(display)) = raw_display_handle {

View File

@ -56,7 +56,7 @@ pub struct EventResponse {
/// (e.g. a mouse click on an egui window, or entering text into a text field).
///
/// For instance, if you use egui for a game, you should only
/// pass on the events to your game when [`Self::consumed`] is `false.
/// pass on the events to your game when [`Self::consumed`] is `false`.
///
/// Note that egui uses `tab` to move focus between elements, so this will always be `true` for tabs.
pub consumed: bool,
@ -1521,6 +1521,9 @@ fn process_viewport_command(
/// Build and intitlaize a window.
///
/// Wrapper around `create_winit_window_builder` and `apply_viewport_builder_to_window`.
///
/// # Errors
/// Possible causes of error include denied permission, incompatible system, and lack of memory.
pub fn create_window<T>(
egui_ctx: &egui::Context,
event_loop: &EventLoopWindowTarget<T>,

View File

@ -13,6 +13,9 @@ categories = ["gui", "game-development"]
keywords = ["gui", "imgui", "immediate", "portable", "gamedev"]
include = ["../LICENSE-APACHE", "../LICENSE-MIT", "**/*.rs", "Cargo.toml"]
[lints]
workspace = true
[package.metadata.docs.rs]
all-features = true

View File

@ -1838,7 +1838,7 @@ impl Context {
let paint_widget_id = |id: Id, text: &str, color: Color32| {
if let Some(widget) =
self.write(|ctx| ctx.viewport().widgets_this_frame.get(id).cloned())
self.write(|ctx| ctx.viewport().widgets_this_frame.get(id).copied())
{
paint_widget(&widget, text, color);
}
@ -2398,7 +2398,7 @@ impl Context {
/// See also [`Response::contains_pointer`].
pub fn rect_contains_pointer(&self, layer_id: LayerId, rect: Rect) -> bool {
let rect =
if let Some(transform) = self.memory(|m| m.layer_transforms.get(&layer_id).cloned()) {
if let Some(transform) = self.memory(|m| m.layer_transforms.get(&layer_id).copied()) {
transform * rect
} else {
rect

View File

@ -35,25 +35,25 @@ pub enum Key {
/// `,`
Comma,
/// '\\'
/// `\`
Backslash,
/// '/'
/// `/`
Slash,
/// '|', a vertical bar
/// `|`, a vertical bar
Pipe,
/// `?`
Questionmark,
// '['
// `[`
OpenBracket,
// ']'
// `]`
CloseBracket,
/// '`', also known as "backquote" or "grave"
/// \`, also known as "backquote" or "grave"
Backtick,
/// `-`

View File

@ -53,7 +53,7 @@ impl BytesLoader for DefaultBytesLoader {
#[cfg(feature = "log")]
log::trace!("forget {uri:?}");
let _ = self.cache.lock().remove(uri);
self.cache.lock().remove(uri);
}
fn forget_all(&self) {

View File

@ -465,7 +465,7 @@ impl Response {
let mut pos = self.ctx.input(|i| i.pointer.hover_pos())?;
if let Some(transform) = self
.ctx
.memory(|m| m.layer_transforms.get(&self.layer_id).cloned())
.memory(|m| m.layer_transforms.get(&self.layer_id).copied())
{
pos = transform * pos;
}

View File

@ -78,7 +78,7 @@ pub fn paint_cursor_end(painter: &Painter, visuals: &Visuals, cursor_rect: Rect)
/// Paint one end of the selection, e.g. the primary cursor, with blinking (if enabled).
pub fn paint_text_cursor(
ui: &mut Ui,
ui: &Ui,
painter: &Painter,
primary_cursor_rect: Rect,
time_since_last_edit: f64,

View File

@ -702,7 +702,7 @@ impl<'t> TextEdit<'t> {
// Set IME output (in screen coords) when text is editable and visible
let transform = ui
.memory(|m| m.layer_transforms.get(&ui.layer_id()).cloned())
.memory(|m| m.layer_transforms.get(&ui.layer_id()).copied())
.unwrap_or_default();
ui.ctx().output_mut(|o| {
@ -948,7 +948,7 @@ fn events(
key,
pressed: true,
..
} => check_for_mutating_key_press(os, &mut cursor_range, text, galley, modifiers, *key),
} => check_for_mutating_key_press(os, &cursor_range, text, galley, modifiers, *key),
Event::Ime(ime_event) => match ime_event {
ImeEvent::Enabled => {
@ -1028,7 +1028,7 @@ fn events(
/// Returns `Some(new_cursor)` if we did mutate `text`.
fn check_for_mutating_key_press(
os: OperatingSystem,
cursor_range: &mut CursorRange,
cursor_range: &CursorRange,
text: &mut dyn TextBuffer,
galley: &Galley,
modifiers: &Modifiers,

View File

@ -8,6 +8,9 @@ rust-version.workspace = true
publish = false
default-run = "egui_demo_app"
[lints]
workspace = true
[package.metadata.docs.rs]
all-features = true

View File

@ -1,3 +1,5 @@
#![allow(clippy::undocumented_unsafe_blocks)]
use std::sync::Arc;
use eframe::egui_glow;

View File

@ -116,7 +116,7 @@ impl eframe::App for HttpApp {
}
}
fn ui_url(ui: &mut egui::Ui, frame: &mut eframe::Frame, url: &mut String) -> bool {
fn ui_url(ui: &mut egui::Ui, frame: &eframe::Frame, url: &mut String) -> bool {
let mut trigger_fetch = false;
ui.horizontal(|ui| {

View File

@ -1,6 +1,7 @@
//! Demo app for egui
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
#![allow(clippy::never_loop)] // False positive
// When compiling natively:

View File

@ -19,6 +19,9 @@ include = [
"data/icon.png",
]
[lints]
workspace = true
[package.metadata.docs.rs]
all-features = true

View File

@ -45,7 +45,7 @@ impl EasyMarkEditor {
pub fn ui(&mut self, ui: &mut egui::Ui) {
egui::Grid::new("controls").show(ui, |ui| {
let _ = ui.button("Hotkeys").on_hover_ui(nested_hotkeys_ui);
let _response = ui.button("Hotkeys").on_hover_ui(nested_hotkeys_ui);
ui.checkbox(&mut self.show_rendered, "Show rendered");
ui.checkbox(&mut self.highlight_editor, "Highlight editor");
egui::reset_button(ui, self, "Reset");

View File

@ -17,6 +17,9 @@ categories = ["gui", "game-development"]
keywords = ["gui", "imgui", "immediate", "portable", "gamedev"]
include = ["../LICENSE-APACHE", "../LICENSE-MIT", "**/*.rs", "Cargo.toml"]
[lints]
workspace = true
[package.metadata.docs.rs]
all-features = true

View File

@ -19,6 +19,9 @@ include = [
"src/shader/*.glsl",
]
[lints]
workspace = true
[package.metadata.docs.rs]
all-features = true

View File

@ -1,8 +1,11 @@
//! Example how to use pure `egui_glow`.
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
#![allow(clippy::undocumented_unsafe_blocks)]
#![allow(clippy::arc_with_non_send_sync)]
// `clippy::arc_with_non_send_sync`: `glow::Context` was accidentally non-Sync in glow 0.13, but that will be fixed in future releases of glow: https://github.com/grovesNL/glow/commit/c4a5f7151b9b4bbb380faa06ec27415235d1bf7e
#![allow(unsafe_code)]
#![allow(clippy::arc_with_non_send_sync)] // glow::Context was accidentally non-Sync in glow 0.13, but that will be fixed in future releases of glow: https://github.com/grovesNL/glow/commit/c4a5f7151b9b4bbb380faa06ec27415235d1bf7e
use std::num::NonZeroU32;

View File

@ -10,6 +10,7 @@
#![allow(clippy::float_cmp)]
#![allow(clippy::manual_range_contains)]
#![allow(clippy::undocumented_unsafe_blocks)]
pub mod painter;
pub use glow;

View File

@ -1,4 +1,5 @@
#![allow(unsafe_code)]
#![allow(clippy::undocumented_unsafe_blocks)]
use std::convert::TryInto;

View File

@ -17,6 +17,9 @@ categories = ["visualization", "gui"]
keywords = ["egui", "plot", "plotting"]
include = ["../LICENSE-APACHE", "../LICENSE-MIT", "**/*.rs", "Cargo.toml"]
[lints]
workspace = true
[package.metadata.docs.rs]
all-features = true

View File

@ -13,6 +13,9 @@ categories = ["mathematics", "gui"]
keywords = ["math", "gui"]
include = ["../LICENSE-APACHE", "../LICENSE-MIT", "**/*.rs", "Cargo.toml"]
[lints]
workspace = true
[package.metadata.docs.rs]
all-features = true

View File

@ -22,6 +22,9 @@ include = [
"fonts/UFL.txt",
]
[lints]
workspace = true
[package.metadata.docs.rs]
all-features = true

View File

@ -7,6 +7,9 @@ edition = "2021"
rust-version = "1.76"
publish = false
[lints]
workspace = true
[dependencies]
eframe = { workspace = true, features = [

View File

@ -1,4 +1,5 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
use eframe::egui;

View File

@ -7,6 +7,9 @@ edition = "2021"
rust-version = "1.76"
publish = false
[lints]
workspace = true
[dependencies]
eframe = { workspace = true, features = [

View File

@ -1,5 +1,7 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
#![allow(unsafe_code)]
#![allow(clippy::undocumented_unsafe_blocks)]
use eframe::{egui, egui_glow, glow};

View File

@ -7,6 +7,9 @@ edition = "2021"
rust-version = "1.76"
publish = false
[lints]
workspace = true
[dependencies]
eframe = { workspace = true, features = [

View File

@ -1,4 +1,5 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
use eframe::egui;

View File

@ -7,6 +7,9 @@ edition = "2021"
rust-version = "1.76"
publish = false
[lints]
workspace = true
[dependencies]
eframe = { workspace = true, features = [

View File

@ -1,4 +1,5 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
use eframe::egui;
use egui::{FontFamily, FontId, RichText, TextStyle};

View File

@ -7,6 +7,9 @@ edition = "2021"
rust-version = "1.76"
publish = false
[lints]
workspace = true
[dependencies]
eframe = { workspace = true, features = [

View File

@ -1,4 +1,5 @@
// #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
use eframe::egui;
mod keypad;

View File

@ -7,6 +7,9 @@ edition = "2021"
rust-version = "1.76"
publish = false
[lints]
workspace = true
[dependencies]
eframe = { workspace = true, features = [

View File

@ -1,5 +1,6 @@
//! This example shows how to implement custom gestures to pan and zoom in the plot
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
use eframe::egui::{self, DragValue, Event, Vec2};
use egui_plot::{Legend, Line, PlotPoints};

View File

@ -7,6 +7,9 @@ edition = "2021"
rust-version = "1.76"
publish = false
[lints]
workspace = true
[dependencies]
eframe = { workspace = true, features = [

View File

@ -1,6 +1,7 @@
//! Show a custom window frame instead of the default OS window chrome decorations.
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
use eframe::egui::{self, ViewportCommand};

View File

@ -7,6 +7,9 @@ edition = "2021"
rust-version = "1.76"
publish = false
[lints]
workspace = true
[dependencies]
eframe = { workspace = true, features = [

View File

@ -1,4 +1,5 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
use eframe::egui;

View File

@ -7,6 +7,9 @@ edition = "2021"
rust-version = "1.76"
publish = false
[lints]
workspace = true
[dependencies]
eframe = { workspace = true, features = [

View File

@ -1,4 +1,5 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
use eframe::egui;

View File

@ -7,6 +7,9 @@ edition = "2021"
rust-version = "1.76"
publish = false
[lints]
workspace = true
[dependencies]
eframe = { workspace = true, default-features = false, features = [

View File

@ -1,6 +1,7 @@
//! This example shows that you can use egui in parallel from multiple threads.
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
use std::sync::mpsc;
use std::thread::JoinHandle;

View File

@ -7,6 +7,9 @@ edition = "2021"
rust-version = "1.76"
publish = false
[lints]
workspace = true
[dependencies]
eframe = { workspace = true, features = [

View File

@ -1,4 +1,5 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
use eframe::egui;

View File

@ -7,6 +7,9 @@ edition = "2021"
rust-version = "1.76"
publish = false
[lints]
workspace = true
[dependencies]
eframe = { workspace = true, features = [

View File

@ -1,4 +1,5 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
use eframe::egui;

View File

@ -7,6 +7,9 @@ edition = "2021"
rust-version = "1.76"
publish = false
[lints]
workspace = true
[dependencies]
eframe = { workspace = true, features = [

View File

@ -1,4 +1,5 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
use eframe::egui;
use egui::*;

View File

@ -7,6 +7,9 @@ edition = "2021"
rust-version = "1.76"
publish = false
[lints]
workspace = true
[features]
wgpu = ["eframe/wgpu"]

View File

@ -1,4 +1,5 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
use std::sync::{
atomic::{AtomicBool, Ordering},

View File

@ -7,6 +7,9 @@ edition = "2021"
rust-version = "1.76"
publish = false
[lints]
workspace = true
[features]
wgpu = ["eframe/wgpu"]

View File

@ -1,4 +1,5 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
use std::sync::{
atomic::{AtomicBool, Ordering},

View File

@ -7,6 +7,9 @@ edition = "2021"
rust-version = "1.76"
publish = false
[lints]
workspace = true
[dependencies]
eframe = { workspace = true, features = [
"default",

View File

@ -1,4 +1,5 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
use eframe::egui;
use egui_plot::{Legend, Line, Plot, PlotPoints};

View File

@ -10,6 +10,9 @@ edition = "2021"
rust-version = "1.76"
publish = false
[lints]
workspace = true
[dependencies]
eframe = { workspace = true, features = [

View File

@ -1,4 +1,5 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
use std::sync::Arc;

View File

@ -7,6 +7,9 @@ edition = "2021"
rust-version = "1.76"
publish = false
[lints]
workspace = true
[dependencies]
eframe = { workspace = true, features = [

View File

@ -1,4 +1,5 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
use eframe::egui;

View File

@ -7,6 +7,9 @@ edition = "2021"
rust-version = "1.76"
publish = false
[lints]
workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View File

@ -1,3 +1,7 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
#![allow(clippy::undocumented_unsafe_blocks)]
// Test that we can paint to the screen using glow directly.
use eframe::egui;

View File

@ -7,6 +7,9 @@ edition = "2021"
rust-version = "1.76"
publish = false
[lints]
workspace = true
[features]
wgpu = ["eframe/wgpu"]

View File

@ -1,3 +1,6 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
use std::sync::Arc;
use eframe::egui;

View File

@ -7,6 +7,9 @@ edition = "2021"
rust-version = "1.76"
publish = false
[lints]
workspace = true
[dependencies]
eframe = { workspace = true, features = [
"default",

View File

@ -1,3 +1,6 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
use eframe::{egui, CreationContext, NativeOptions};
use egui::{Button, CentralPanel, Context, UserAttentionType};

View File

@ -9,7 +9,6 @@ set -x
# Checks all tests, lints etc.
# Basically does what the CI does.
cargo install --quiet cargo-cranky # Uses lints defined in Cranky.toml. See https://github.com/ericseppanen/cargo-cranky
cargo +1.75.0 install --quiet typos-cli
# web_sys_unstable_apis is required to enable the web_sys clipboard API which eframe web uses,
@ -24,7 +23,7 @@ cargo fmt --all -- --check
cargo doc --quiet --lib --no-deps --all-features
cargo doc --quiet --document-private-items --no-deps --all-features
cargo cranky --quiet --all-targets --all-features -- -D warnings
cargo clippy --quiet --all-targets --all-features -- -D warnings
./scripts/clippy_wasm.sh
cargo check --quiet --all-targets

View File

@ -10,4 +10,4 @@ set -x
# Use scripts/clippy_wasm/clippy.toml
export CLIPPY_CONF_DIR="scripts/clippy_wasm"
cargo cranky --quiet --all-features --target wasm32-unknown-unknown --target-dir target_wasm -p egui_demo_app --lib -- --deny warnings
cargo clippy --quiet --all-features --target wasm32-unknown-unknown --target-dir target_wasm -p egui_demo_app --lib -- --deny warnings

View File

@ -6,4 +6,7 @@ rust-version.workspace = true
version.workspace = true
publish = false
[lints]
workspace = true
[dependencies]

View File

@ -1,3 +1,5 @@
//! Helper crate for running scripts within the `egui` repo
#![allow(clippy::print_stdout)]
#![allow(clippy::print_stderr)]
#![allow(clippy::exit)]