[workspace]
resolver = "2"
members = [
  "crates/ecolor",
  "crates/egui_demo_app",
  "crates/egui_demo_lib",
  "crates/egui_extras",
  "crates/egui_glow",
  "crates/egui_inspection",
  "crates/egui_kittest",
  "crates/egui-wgpu",
  "crates/egui-winit",
  "crates/egui",
  "crates/emath",
  "crates/epaint",
  "crates/epaint_default_fonts",

  "examples/*",
  "tests/*",

  "xtask",
]

[workspace.package]
edition = "2024"
license = "MIT OR Apache-2.0"
rust-version = "1.95"
version = "0.36.1"


[profile.release]
# lto = true # VERY slightly smaller wasm
# opt-level = 's' # 10-20% smaller wasm compared to `opt-level = 3`
# opt-level = 1 # very slow and big wasm. Don't do this.
opt-level = 2 # fast and small wasm, basically same as `opt-level = 's'`
# opt-level = 3 # unnecessarily large wasm for no performance gain

# debug = true # include debug symbols, useful when profiling wasm

panic = "abort" # This leads to better optimizations and smaller binaries (and is the default in Wasm anyways).


[profile.dev]
# Can't leave this on by default, because it breaks the Windows build. Related: https://github.com/rust-lang/cargo/issues/4897
# split-debuginfo = "unpacked" # faster debug builds on mac
# opt-level = 1                # Make debug builds run faster

# panic = "abort" leads to better optimizations and smaller binaries (and is the default in Wasm anyways),
# but it also means backtraces don't work with the `backtrace` library (https://github.com/rust-lang/backtrace-rs/issues/397).
# egui has a feature where if you hold down all modifiers keys on your keyboard and hover any UI widget,
# you will see the backtrace to that widget, and we don't want to break that feature in dev builds.

[profile.dev.package."*"]
# Optimize all dependencies even in debug builds (does not affect workspace packages):
opt-level = 2


[workspace.dependencies]
emath = { version = "0.36.1", path = "crates/emath", default-features = false }
ecolor = { version = "0.36.1", path = "crates/ecolor", default-features = false }
epaint = { version = "0.36.1", path = "crates/epaint", default-features = false }
epaint_default_fonts = { version = "0.36.1", path = "crates/epaint_default_fonts" }
egui = { version = "0.36.1", path = "crates/egui", default-features = false }
egui-winit = { version = "0.36.1", path = "crates/egui-winit", default-features = false }
egui_extras = { version = "0.36.1", path = "crates/egui_extras", default-features = false }
egui-wgpu = { version = "0.36.1", path = "crates/egui-wgpu", default-features = false }
egui_demo_lib = { version = "0.36.1", path = "crates/egui_demo_lib", default-features = false }
egui_glow = { version = "0.36.1", path = "crates/egui_glow", default-features = false }
egui_inspection = { version = "0.36.1", path = "crates/egui_inspection", default-features = false }
egui_kittest = { version = "0.36.1", path = "crates/egui_kittest", default-features = false }
eframe = { version = "0.36.1", path = "crates/eframe", default-features = false }

accesskit = "0.24.1"
accesskit_consumer = "0.35.0" # Can't update to 0.36+: kittest 0.4 pins accesskit_consumer 0.35, so bumping splits it into two versions
accesskit_winit = "0.32.0" # Can't update to 0.33: it needs accesskit_macos 0.26.2, which pulls accesskit_consumer 0.37, duplicating the 0.35 that kittest 0.4 needs. For the same reason, `accesskit_macos` is held at 0.26.0 in `Cargo.lock`.
ahash = { version = "0.8.12", default-features = false, features = [
  "no-rng", # we don't need DOS-protection, so we let users opt-in to it instead
  "std",
] }
android_logger = "0.15.1"
arboard = { version = "3.6", default-features = false }
backtrace = "0.3.76"
bitflags = "2.13"
bytemuck = "1.25"
cint = "0.3.1"
color-hex = "0.2.0"
criterion = { version = "0.8.2", default-features = false }
dify = { version = "0.8.0", default-features = false }
directories = "6.0"
document-features = "0.2.12"
ehttp = { version = "0.7.1", default-features = false }
enum-map = "2.7" # Can't update to 3.1: its `enum-map-derive` moved to syn 3, duplicating the syn 2 that most other proc-macro crates still use
env_logger = { version = "0.11.8", default-features = false } # 0.11.9+ pulls env_filter 1.x/2.x, duplicating the 0.1.x that android_logger needs
font-types = { version = "0.12.2", default-features = false, features = ["std"] }
glow = "0.17.0" # Can't update to 0.18: wgpu 30's wgpu-hal pins glow 0.17, so bumping splits it into two versions
glutin = { version = "0.32.3", default-features = false }
glutin-winit = { version = "0.5.0", default-features = false }
harfrust = "0.12.0"
image = { version = "0.25.6", default-features = false } # Can't update to 0.25.7+: it needs png 0.18, which only matches resvg once resvg moves to tiny-skia 0.12 — blocked, see resvg below
itertools = "0.15.0"
jiff = { version = "0.2.35", default-features = false }
js-sys = "0.3.103"
kittest = { version = "0.4.0" }
log = { version = "0.4.33", features = ["std"] }
mimalloc = "0.1.52"
mime_guess2 = { version = "2.3", default-features = false }
mint = "0.5.9"
nohash-hasher = "0.2.0"
objc2 = "0.6.4"
objc2-app-kit = { version = "0.3.2", default-features = false }
objc2-foundation = { version = "0.3.2", default-features = false }
objc2-ui-kit = { version = "0.3.2", default-features = false }
open = "5.4"
parking_lot = "0.12.5"
percent-encoding = "2.3"
poll-promise = { version = "0.3.0", default-features = false }
pollster = "1.0"
profiling = { version = "1.0", default-features = false }
puffin = "0.20.0"
puffin_http = "0.17.0"
rand = "0.10.2"
raw-window-handle = "0.6.2"
rayon = "1.12"
resvg = { version = "0.45.1", default-features = false } # Can't update to 0.47+: it needs tiny-skia 0.12, but winit 0.30's sctk-adwaita 0.10 is stuck on tiny-skia 0.11, so bumping duplicates tiny-skia. (0.46 keeps tiny-skia 0.11 but its fontconfig-parser duplicates roxmltree.)
rfd = "0.17.2"
rmp-serde = "1.3"
ron = "0.12.2"
self_cell = "1.3"
# `serde_derive` is held at 1.0.228 in `Cargo.lock`: 1.0.229 moved to syn 3, duplicating the syn 2 that most other proc-macro crates still use
serde = { version = "1.0", features = ["derive"] }
serde_bytes = "0.11.19"
similar-asserts = "2.0"
skrifa = { version = "0.44.0", default-features = false, features = [
  "std",
  "autohint_shaping",
] } # Can't update to 0.45: it needs read-fonts 0.42, but harfrust 0.12 pins read-fonts 0.41, so bumping splits read-fonts into two versions
smallvec = "1.15"
smithay-clipboard = "0.7.2" # 0.7.3 pulls smithay-client-toolkit 0.20 (calloop 0.14), duplicating the 0.19/0.13 that winit 0.30 needs
static_assertions = "1.1"
syntect = { version = "5.3", default-features = false }
tempfile = "3.27"
thiserror = "2.0" # Held at 2.0.18 in `Cargo.lock`: `thiserror-impl` 2.0.19 moved to syn 3, duplicating the syn 2 that most other proc-macro crates still use
tokio = "1.53"
toml = { version = "1.1", default-features = false }
type-map = "0.5.1"
unicode_names2 = { version = "3.1", default-features = false }
unicode-general-category = "1.1"
unicode-segmentation = "1.13"
vello_cpu = { version = "0.2.0", default-features = false, features = [
  "std",
  "u8_pipeline",
  "f32_pipeline",
] }
wasm-bindgen = "0.2.126" # Keep wasm-bindgen version in sync in: setup_web.sh, Cargo.toml, Cargo.lock, rust.yml. Don't update this spuriously, because of https://github.com/rerun-io/rerun/issues/8766
wasm-bindgen-futures = "0.4.76"
wayland-cursor = { version = "0.31.14", default-features = false }
web-sys = "0.3.103"
web-time = "1.1" # Timekeeping for native and web
webbrowser = "1.2.2" # 1.2.2 fixes RUSTSEC-2026-0257 (`BROWSER` argument injection)
wgpu = { version = "30.0", default-features = false, features = ["std"] }
windows-sys = "0.61.2"
winit = { version = "0.30.13", default-features = false }

[workspace.lints.rust]
unsafe_code = "deny"

future_incompatible = { level = "warn", priority = -1 }
nonstandard_style = { level = "warn", priority = -1 }
rust_2018_idioms = { level = "warn", priority = -1 }
trivial_numeric_casts = "warn"
unused_import_braces = "warn"
unused_lifetimes = "warn"

trivial_casts = "allow"
unused_qualifications = "allow"

[workspace.lints.rustdoc]
all = "warn"

# See also clippy.toml
[workspace.lints.clippy]
# `all` = `correctness` + `suspicious` + `style` + `complexity` + `perf`.
# The remaining groups are `nursery` and `restriction`,
# which are not meant to be enabled wholesale - we cherry-pick from them below.
all = { level = "warn", priority = -1 }
cargo = { level = "warn", priority = -1 }
pedantic = { level = "warn", priority = -1 }

allow_attributes = "warn"
as_ptr_cast_mut = "warn"
branches_sharing_code = "warn"
clear_with_drain = "warn"
clone_on_ref_ptr = "warn"
coerce_container_to_any = "warn"
dbg_macro = "warn"
debug_assert_with_mut_call = "warn"
default_union_representation = "warn"
derive_partial_eq_without_eq = "warn"
disallowed_script_idents = "warn" # See clippy.toml
doc_include_without_cfg = "warn"
empty_enum_variants_with_brackets = "warn"
equatable_if_let = "warn"
exit = "warn"
fallible_impl_from = "warn"
float_cmp_const = "warn"
fn_to_numeric_cast_any = "warn"
get_unwrap = "warn"
imprecise_flops = "warn"
infinite_loop = "warn"
iter_on_empty_collections = "warn"
iter_on_single_items = "warn"
iter_over_hash_type = "warn"
large_include_file = "warn"
large_stack_frames = "warn"
literal_string_with_formatting_args = "warn"
lossy_float_literal = "warn"
map_err_ignore = "warn"
mem_forget = "warn"
missing_assert_message = "warn"
mutex_integer = "warn"
needless_pass_by_ref_mut = "warn"
needless_type_cast = "warn"
non_zero_suggestions = "warn"
nonstandard_macro_braces = "warn"
or_fun_call = "warn"
path_buf_push_overwrite = "warn"
pathbuf_init_then_push = "warn"
precedence_bits = "warn"
print_stderr = "warn"
print_stdout = "warn"
pub_without_shorthand = "warn"
rc_mutex = "warn"
redundant_type_annotations = "warn"
ref_patterns = "warn"
rest_pat_in_fully_bound_structs = "warn"
return_and_then = "warn"
set_contains_or_insert = "warn"
single_option_map = "warn"
std_instead_of_core = "warn"
str_to_string = "warn"
string_add = "warn"
string_lit_as_bytes = "warn"
string_lit_chars_any = "warn"
suspicious_xor_used_as_pow = "warn"
todo = "warn"
too_long_first_doc_paragraph = "warn"
trailing_empty_array = "warn"
trait_duplication_in_bounds = "warn"
tuple_array_conversions = "warn"
undocumented_unsafe_blocks = "warn"
unimplemented = "warn"
uninhabited_references = "warn"
unnecessary_safety_comment = "warn"
unnecessary_safety_doc = "warn"
unnecessary_self_imports = "warn"
unnecessary_struct_initialization = "warn"
unused_peekable = "warn"
unused_rounding = "warn"
unused_trait_names = "warn"
unwrap_used = "warn"
use_self = "warn"
useless_let_if_seq = "warn"
verbose_file_reads = "warn"


# Pedantic lints we opt out of, with the number of hits at the time we enabled `pedantic`:
cast_lossless = "allow" # 204 hits
cast_possible_truncation = "allow" # 287 hits
cast_possible_wrap = "allow" # 43 hits
cast_precision_loss = "allow" # 200 hits
cast_sign_loss = "allow" # 98 hits
comparison_chain = "allow"
default_trait_access = "allow" # 278 hits
float_cmp = "allow" # exact float comparisons are usually intentional (`float_cmp_const` is still on)
inline_always = "allow" # 271 hits; we know what we are doing
items_after_statements = "allow" # 82 hits
many_single_char_names = "allow" # `r, g, b, a` and `h, s, v` are fine
missing_panics_doc = "allow" # 68 hits
must_use_candidate = "allow" # 1169 hits
redundant_closure_for_method_calls = "allow" # 89 hits
return_self_not_must_use = "allow" # 246 hits
should_panic_without_expect = "allow"
similar_names = "allow" # too many false positives, e.g. `encoder`/`encoded`
struct_excessive_bools = "allow" # 32 hits
struct_field_names = "allow" # 23 hits
too_many_lines = "allow"
trivially_copy_pass_by_ref = "allow" # 119 hits
unreadable_literal = "allow" # 513 hits
used_underscore_binding = "allow" # 25 hits

# Other:
assigning_clones = "allow" # No please
manual_range_contains = "allow" # this one is just worse imho
map_unwrap_or = "allow" # so is this one
multiple_crate_versions = "allow" # we handle this with `cargo deny`
wildcard_imports = "allow" # `use crate::*` is useful to avoid merge conflicts when adding/removing imports

# NOTE: these are in `restriction`/`nursery`, so the `allow` is a no-op today.
# We keep them to record our intent in case we ever enable those groups.
let_underscore_must_use = "allow"
let_underscore_untyped = "allow"
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
