Skip to content

Commit df8793a

Browse files
emilkclaude
andauthored
Update to Rust 1.95 (#252)
* Bump toolchain, MSRV and CI to Rust 1.95.0 * Enable the workspace lints that are enabled in the main `egui` repo but were missing here (`unexpected_cfgs`, `rustdoc::broken_intra_doc_links`, and 14 clippy lints) * Rename `clippy::empty_enum` -> `clippy::empty_enums` (renamed upstream) Only `clippy::ref_option` had hits. Fixing it changes `PlotItem::on_hover`'s `label_formatter` parameter from `&Option<LabelFormatter<'_>>` to `Option<&LabelFormatterFn<'_>>`, so `LabelFormatterFn` is now public. Breaking for anyone implementing `PlotItem` manually. Lints that are stricter here than in `egui` (e.g. `expect_used`, `too_many_lines`, `wildcard_imports`) were left as-is. `./scripts/check.sh` passes. * [x] I have followed the instructions in the PR template 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 7074b29 commit df8793a

17 files changed

Lines changed: 62 additions & 41 deletions

File tree

.github/workflows/rust.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- uses: actions-rs/toolchain@v1
2323
with:
2424
profile: default
25-
toolchain: 1.92.0
25+
toolchain: 1.95.0
2626
override: true
2727

2828
- name: Install packages (Linux)
@@ -70,7 +70,7 @@ jobs:
7070
- uses: actions-rs/toolchain@v1
7171
with:
7272
profile: minimal
73-
toolchain: 1.92.0
73+
toolchain: 1.95.0
7474
target: wasm32-unknown-unknown
7575
override: true
7676
components: clippy
@@ -95,7 +95,7 @@ jobs:
9595
- uses: actions/checkout@v3
9696
- uses: EmbarkStudios/cargo-deny-action@v2
9797
with:
98-
rust-version: "1.92.0"
98+
rust-version: "1.95.0"
9999
log-level: warn
100100
command: check
101101

@@ -109,7 +109,7 @@ jobs:
109109
- uses: actions-rs/toolchain@v1
110110
with:
111111
profile: minimal
112-
toolchain: 1.92.0
112+
toolchain: 1.95.0
113113
target: wasm32-unknown-unknown
114114
override: true
115115
- name: Download and install Trunk binary
@@ -131,7 +131,7 @@ jobs:
131131
lfs: true
132132
- uses: dtolnay/rust-toolchain@master
133133
with:
134-
toolchain: 1.92.0
134+
toolchain: 1.95.0
135135

136136
- name: Set up cargo cache
137137
uses: Swatinem/rust-cache@v2

Cargo.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,9 +867,9 @@ dependencies = [
867867

868868
[[package]]
869869
name = "crossbeam-epoch"
870-
version = "0.9.18"
870+
version = "0.9.20"
871871
source = "registry+https://github.com/rust-lang/crates.io-index"
872-
checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
872+
checksum = "2d6914041f254d6e9176c01941b21115dcfb7089e55135a35411081bd106ef3f"
873873
dependencies = [
874874
"crossbeam-utils",
875875
]

Cargo.toml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ members = [
1111
[workspace.package]
1212
edition = "2024"
1313
license = "MIT OR Apache-2.0"
14-
rust-version = "1.92"
14+
rust-version = "1.95"
1515
version = "0.36.0"
1616

1717

@@ -92,6 +92,7 @@ rust_2018_idioms = { level = "warn", priority = -1 }
9292
rust_2021_prelude_collisions = "warn"
9393
semicolon_in_expressions_from_macros = "warn"
9494
trivial_numeric_casts = "warn"
95+
unexpected_cfgs = "warn"
9596
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
9697
unused_extern_crates = "warn"
9798
unused_import_braces = "warn"
@@ -103,6 +104,7 @@ unused_qualifications = "allow"
103104

104105
[workspace.lints.rustdoc]
105106
all = "warn"
107+
broken_intra_doc_links = "warn"
106108
missing_crate_level_docs = "warn"
107109

108110
# See also clippy.toml
@@ -124,6 +126,7 @@ coerce_container_to_any = "warn"
124126
comparison_chain = "warn"
125127
dbg_macro = "warn"
126128
debug_assert_with_mut_call = "warn"
129+
decimal_bitwise_operands = "warn"
127130
default_union_representation = "warn"
128131
derive_partial_eq_without_eq = "warn"
129132
disallowed_macros = "warn" # See clippy.toml
@@ -136,9 +139,10 @@ doc_comment_double_space_linebreaks = "warn"
136139
doc_include_without_cfg = "warn"
137140
doc_link_with_quotes = "warn"
138141
doc_markdown = "warn"
142+
duration_suboptimal_units = "warn"
139143
elidable_lifetime_names = "warn"
140-
empty_enum = "warn"
141144
empty_enum_variants_with_brackets = "warn"
145+
empty_enums = "warn"
142146
empty_line_after_outer_attr = "warn"
143147
enum_glob_use = "warn"
144148
equatable_if_let = "warn"
@@ -154,10 +158,12 @@ flat_map_option = "warn"
154158
float_cmp_const = "warn"
155159
fn_params_excessive_bools = "warn"
156160
fn_to_numeric_cast_any = "warn"
161+
format_push_string = "warn"
157162
from_iter_instead_of_collect = "warn"
158163
get_unwrap = "warn"
159164
if_let_mutex = "warn"
160165
ignore_without_reason = "warn"
166+
ignored_unit_patterns = "warn"
161167
implicit_clone = "warn"
162168
implied_bounds_in_impls = "warn"
163169
imprecise_flops = "warn"
@@ -190,6 +196,7 @@ lossy_float_literal = "warn"
190196
macro_use_imports = "warn"
191197
manual_assert = "warn"
192198
manual_clamp = "warn"
199+
manual_ilog2 = "warn"
193200
manual_instant_elapsed = "warn"
194201
manual_is_power_of_two = "warn"
195202
manual_is_variant_and = "warn"
@@ -208,6 +215,7 @@ mismatching_type_param_order = "warn"
208215
missing_assert_message = "warn"
209216
missing_enforced_import_renames = "warn"
210217
missing_errors_doc = "warn"
218+
missing_fields_in_debug = "warn"
211219
missing_safety_doc = "warn"
212220
mixed_attributes_style = "warn"
213221
mut_mut = "warn"
@@ -217,10 +225,13 @@ needless_continue = "warn"
217225
needless_for_each = "warn"
218226
needless_pass_by_ref_mut = "warn"
219227
needless_pass_by_value = "warn"
228+
needless_raw_string_hashes = "warn"
229+
needless_type_cast = "warn"
220230
negative_feature_names = "warn"
221231
non_std_lazy_statics = "warn"
222232
non_zero_suggestions = "warn"
223233
nonstandard_macro_braces = "warn"
234+
only_used_in_recursion = "warn"
224235
option_as_ref_cloned = "warn"
225236
option_option = "warn"
226237
or_fun_call = "warn"
@@ -237,11 +248,13 @@ rc_mutex = "warn"
237248
readonly_write_lock = "warn"
238249
redundant_type_annotations = "warn"
239250
ref_as_ptr = "warn"
251+
ref_option = "warn"
240252
ref_option_ref = "warn"
241253
ref_patterns = "warn"
242254
rest_pat_in_fully_bound_structs = "warn"
243255
return_and_then = "warn"
244256
same_functions_in_if_condition = "warn"
257+
same_length_and_capacity = "warn"
245258
self_only_used_in_recursion = "warn"
246259
semicolon_if_nothing_returned = "warn"
247260
set_contains_or_insert = "warn"
@@ -259,6 +272,7 @@ suspicious_command_arg_space = "warn"
259272
suspicious_xor_used_as_pow = "warn"
260273
todo = "warn"
261274
too_long_first_doc_paragraph = "warn"
275+
too_many_arguments = "warn"
262276
too_many_lines = "warn"
263277
trailing_empty_array = "warn"
264278
trait_duplication_in_bounds = "warn"
@@ -277,6 +291,7 @@ unnecessary_safety_doc = "warn"
277291
unnecessary_self_imports = "warn"
278292
unnecessary_semicolon = "warn"
279293
unnecessary_struct_initialization = "warn"
294+
unnecessary_trailing_comma = "warn"
280295
unnecessary_wraps = "warn"
281296
unnested_or_patterns = "warn"
282297
unused_async = "warn"

clippy.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# -----------------------------------------------------------------------------
66
# Section identical to scripts/clippy_wasm/clippy.toml:
77

8-
msrv = "1.92"
8+
msrv = "1.95"
99

1010
allow-unwrap-in-tests = true
1111

deny.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ all-features = true
3131
[advisories]
3232
version = 2
3333
ignore = [
34-
"RUSTSEC-2024-0436", # https://rustsec.org/advisories/RUSTSEC-2024-0436 - paste is unmaintained - https://github.com/dtolnay/paste
34+
# All of these come in via `eframe`, which is only a dev-dependency of ours,
35+
# and only on Linux. We cannot upgrade them without upstream doing so first.
36+
"RUSTSEC-2026-0192", # https://rustsec.org/advisories/RUSTSEC-2026-0192 - ttf-parser is unmaintained, via ab_glyph -> sctk-adwaita -> winit. There is no fixed version.
37+
"RUSTSEC-2026-0194", # https://rustsec.org/advisories/RUSTSEC-2026-0194 - quick-xml DoS, via zbus_xml -> accesskit_unix. Fixed in 0.41, but zbus_xml requires 0.39.
38+
"RUSTSEC-2026-0195", # https://rustsec.org/advisories/RUSTSEC-2026-0195 - quick-xml DoS, via zbus_xml -> accesskit_unix. Fixed in 0.41, but zbus_xml requires 0.39.
3539
]
3640

3741

egui_plot/src/aesthetics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl LineStyle {
6767
if highlight {
6868
stroke.width *= 2.0;
6969
}
70-
let golden_ratio = (5.0_f32.sqrt() - 1.0) / 2.0; // 0.61803398875
70+
let golden_ratio = std::f32::consts::GOLDEN_RATIO - 1.0; // 0.61803398875
7171
shapes.extend(Shape::dashed_line(
7272
&line,
7373
Stroke::new(stroke.width, path_stroke_color),

egui_plot/src/items/bar_chart.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use crate::items::PlotGeometry;
2323
use crate::items::PlotItem;
2424
use crate::items::PlotItemBase;
2525
use crate::items::add_rulers_and_text;
26-
use crate::label::LabelFormatter;
26+
use crate::label::LabelFormatterFn;
2727
use crate::math::find_closest_rect;
2828
use crate::rect_elem::RectElement;
2929

@@ -210,7 +210,7 @@ impl PlotItem for BarChart {
210210
shapes: &mut Vec<Shape>,
211211
cursors: &mut Vec<Cursor>,
212212
plot: &PlotConfig<'_>,
213-
_: &Option<LabelFormatter<'_>>,
213+
_: Option<&LabelFormatterFn<'_>>,
214214
) {
215215
let bar = &self.bars[elem.index];
216216

egui_plot/src/items/box_plot.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use crate::items::PlotGeometry;
2222
use crate::items::PlotItem;
2323
use crate::items::PlotItemBase;
2424
use crate::items::add_rulers_and_text;
25-
use crate::label::LabelFormatter;
25+
use crate::label::LabelFormatterFn;
2626
use crate::math::find_closest_rect;
2727
use crate::rect_elem::RectElement;
2828

@@ -176,7 +176,7 @@ impl PlotItem for BoxPlot {
176176
shapes: &mut Vec<Shape>,
177177
cursors: &mut Vec<Cursor>,
178178
plot: &PlotConfig<'_>,
179-
_: &Option<LabelFormatter<'_>>,
179+
_: Option<&LabelFormatterFn<'_>>,
180180
) {
181181
let box_plot = &self.boxes[elem.index];
182182

egui_plot/src/items/heatmap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use crate::items::PlotConfig;
2424
use crate::items::PlotGeometry;
2525
use crate::items::PlotItem;
2626
use crate::items::PlotItemBase;
27-
use crate::label::LabelFormatter;
27+
use crate::label::LabelFormatterFn;
2828

2929
/// Default resolution for heatmap color palette
3030
pub const DEFAULT_RESOLUTION: usize = 128;
@@ -459,7 +459,7 @@ impl PlotItem for Heatmap {
459459
shapes: &mut Vec<Shape>,
460460
_cursors: &mut Vec<Cursor>,
461461
plot: &PlotConfig<'_>,
462-
_: &Option<LabelFormatter<'_>>,
462+
_: Option<&LabelFormatterFn<'_>>,
463463
) {
464464
let (rect, color, text) = self.tile_view_info(plot.ui, plot.transform, elem.index);
465465
let mut mesh = Mesh::default();

egui_plot/src/items/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub use crate::items::series::Line;
4141
pub use crate::items::span::Span;
4242
pub use crate::items::text::Text;
4343
use crate::label::HoverPosition;
44-
use crate::label::LabelFormatter;
44+
use crate::label::LabelFormatterFn;
4545
use crate::rect_elem::RectElement;
4646

4747
mod arrows;
@@ -175,7 +175,7 @@ pub trait PlotItem {
175175
shapes: &mut Vec<Shape>,
176176
cursors: &mut Vec<Cursor>,
177177
plot: &PlotConfig<'_>,
178-
label_formatter: &Option<LabelFormatter<'_>>,
178+
label_formatter: Option<&LabelFormatterFn<'_>>,
179179
) {
180180
let points = match self.geometry() {
181181
PlotGeometry::Points(points) => points,
@@ -283,7 +283,7 @@ pub(super) fn rulers_and_tooltip_at_value(
283283
nearest_point: Option<(&str, usize)>,
284284
plot: &PlotConfig<'_>,
285285
cursors: &mut Vec<Cursor>,
286-
label_formatter: &Option<LabelFormatter<'_>>,
286+
label_formatter: Option<&LabelFormatterFn<'_>>,
287287
) {
288288
// Add crosshair rulers if enabled
289289
if plot.show_crosshair {

0 commit comments

Comments
 (0)