Skip to content

Commit c51d2b5

Browse files
authored
Update MSRV to 1.92 (#238)
In preparation for egui 0.34
1 parent 445273e commit c51d2b5

34 files changed

Lines changed: 133 additions & 130 deletions

File tree

.github/workflows/rust.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
branches:
55
- "main"
66
pull_request:
7-
types: [ opened, synchronize ]
7+
types: [opened, synchronize]
88

99
name: Rust
1010

@@ -22,7 +22,7 @@ jobs:
2222
- uses: actions-rs/toolchain@v1
2323
with:
2424
profile: default
25-
toolchain: 1.88.0
25+
toolchain: 1.92.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.88.0
73+
toolchain: 1.92.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.88.0"
98+
rust-version: "1.92.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.88.0
112+
toolchain: 1.92.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.88.0
134+
toolchain: 1.92.0
135135

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

Cargo.toml

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ members = ["egui_plot", "demo", "examples/*", "examples_utils"]
66
[workspace.package]
77
edition = "2024"
88
license = "MIT OR Apache-2.0"
9-
rust-version = "1.88"
9+
rust-version = "1.92"
1010
version = "0.34.1"
1111

1212

@@ -102,26 +102,33 @@ missing_crate_level_docs = "warn"
102102

103103
# See also clippy.toml
104104
[workspace.lints.clippy]
105+
all = { level = "warn", priority = -1 }
106+
105107
allow_attributes = "warn"
106-
allow_attributes_without_reason = "warn"
107108
as_ptr_cast_mut = "warn"
108109
await_holding_lock = "warn"
109110
bool_to_int_with_if = "warn"
110111
branches_sharing_code = "warn"
112+
cast_possible_wrap = "warn"
111113
char_lit_as_u8 = "warn"
112114
checked_conversions = "warn"
113115
clear_with_drain = "warn"
116+
clone_on_ref_ptr = "warn"
114117
cloned_instead_of_copied = "warn"
118+
coerce_container_to_any = "warn"
119+
comparison_chain = "warn"
115120
dbg_macro = "warn"
116121
debug_assert_with_mut_call = "warn"
117122
default_union_representation = "warn"
118123
derive_partial_eq_without_eq = "warn"
119-
disallowed_macros = "warn" # See clippy.toml
120-
disallowed_methods = "warn" # See clippy.toml
121-
disallowed_names = "warn" # See clippy.toml
122-
disallowed_script_idents = "warn" # See clippy.toml
123-
disallowed_types = "warn" # See clippy.toml
124+
disallowed_macros = "warn" # See clippy.toml
125+
disallowed_methods = "warn" # See clippy.toml
126+
disallowed_names = "warn" # See clippy.toml
127+
disallowed_script_idents = "warn" # See clippy.toml
128+
disallowed_types = "warn" # See clippy.toml
129+
doc_broken_link = "warn"
124130
doc_comment_double_space_linebreaks = "warn"
131+
doc_include_without_cfg = "warn"
125132
doc_link_with_quotes = "warn"
126133
doc_markdown = "warn"
127134
elidable_lifetime_names = "warn"
@@ -155,6 +162,7 @@ inefficient_to_string = "warn"
155162
infinite_loop = "warn"
156163
into_iter_without_iter = "warn"
157164
invalid_upcast_comparisons = "warn"
165+
ip_constant = "warn"
158166
iter_filter_is_ok = "warn"
159167
iter_filter_is_some = "warn"
160168
iter_not_returning_iterator = "warn"
@@ -163,6 +171,7 @@ iter_on_single_items = "warn"
163171
iter_over_hash_type = "warn"
164172
iter_without_into_iter = "warn"
165173
large_digit_groups = "warn"
174+
large_futures = "warn"
166175
large_include_file = "warn"
167176
large_stack_arrays = "warn"
168177
large_stack_frames = "warn"
@@ -228,6 +237,7 @@ ref_patterns = "warn"
228237
rest_pat_in_fully_bound_structs = "warn"
229238
return_and_then = "warn"
230239
same_functions_in_if_condition = "warn"
240+
self_only_used_in_recursion = "warn"
231241
semicolon_if_nothing_returned = "warn"
232242
set_contains_or_insert = "warn"
233243
should_panic_without_expect = "warn"
@@ -240,7 +250,6 @@ string_add = "warn"
240250
string_add_assign = "warn"
241251
string_lit_as_bytes = "warn"
242252
string_lit_chars_any = "warn"
243-
string_to_string = "warn"
244253
suspicious_command_arg_space = "warn"
245254
suspicious_xor_used_as_pow = "warn"
246255
todo = "warn"
@@ -250,7 +259,7 @@ trailing_empty_array = "warn"
250259
trait_duplication_in_bounds = "warn"
251260
transmute_ptr_to_ptr = "warn"
252261
tuple_array_conversions = "warn"
253-
unchecked_duration_subtraction = "warn"
262+
unchecked_time_subtraction = "warn"
254263
undocumented_unsafe_blocks = "warn"
255264
unimplemented = "warn"
256265
uninhabited_references = "warn"
@@ -265,6 +274,7 @@ unnecessary_semicolon = "warn"
265274
unnecessary_struct_initialization = "warn"
266275
unnecessary_wraps = "warn"
267276
unnested_or_patterns = "warn"
277+
unused_async = "warn"
268278
unused_peekable = "warn"
269279
unused_rounding = "warn"
270280
unused_self = "warn"
@@ -278,8 +288,11 @@ wildcard_dependencies = "warn"
278288
wildcard_imports = "warn"
279289
zero_sized_map_values = "warn"
280290

281-
manual_range_contains = "allow" # this is better on 'allow'
282-
map_unwrap_or = "allow" # this is better on 'allow'
291+
assigning_clones = "allow" # No please
292+
manual_range_contains = "allow" # this one is just worse imho
293+
map_unwrap_or = "allow" # so is this one
294+
self_named_module_files = "allow" # Disabled waiting on https://github.com/rust-lang/rust-clippy/issues/9602
295+
significant_drop_tightening = "allow" # Too many false positives
283296

284297

285298
[workspace.metadata.cargo-shear]

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.88"
8+
msrv = "1.92"
99

1010
allow-unwrap-in-tests = true
1111

demo/src/app.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,8 @@ impl DemoGallery {
6767
let is_small_screen = screen_rect.width() < 1024.0;
6868

6969
Self::top_bar(ctx);
70-
if !is_small_screen {
71-
if let Some(index) = self.current_example {
72-
self.info_panel(ctx, index);
73-
}
70+
if !is_small_screen && let Some(index) = self.current_example {
71+
self.info_panel(ctx, index);
7472
}
7573
self.thumbnails_panel(ctx, screen_rect.width() / 3.0);
7674
self.demo_panel(ctx);

egui_plot/src/aesthetics.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,13 @@ impl std::fmt::Display for LineStyle {
9292
}
9393

9494
/// Determines whether a plot element is vertically or horizontally oriented.
95-
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
95+
#[derive(Copy, Clone, Debug, PartialEq, Eq, Default)]
9696
pub enum Orientation {
9797
Horizontal,
98+
#[default]
9899
Vertical,
99100
}
100101

101-
impl Default for Orientation {
102-
fn default() -> Self {
103-
Self::Vertical
104-
}
105-
}
106-
107102
/// Circle, Diamond, Square, Cross, …
108103
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
109104
pub enum MarkerShape {

egui_plot/src/grid.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,14 @@ fn generate_marks(step_sizes: [f64; 3], bounds: (f64, f64)) -> Vec<GridMark> {
119119

120120
let mut deduplicated: Vec<GridMark> = Vec::with_capacity(steps.len());
121121
for step in steps {
122-
if let Some(last) = deduplicated.last_mut() {
123-
if (last.value - step.value).abs() < eps {
124-
// Keep the one with the largest step size
125-
if last.step_size < step.step_size {
126-
*last = step;
127-
}
128-
continue;
122+
if let Some(last) = deduplicated.last_mut()
123+
&& (last.value - step.value).abs() < eps
124+
{
125+
// Keep the one with the largest step size
126+
if last.step_size < step.step_size {
127+
*last = step;
129128
}
129+
continue;
130130
}
131131
deduplicated.push(step);
132132
}

egui_plot/src/items/bar_chart.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub struct BarChart {
3535
default_color: Color32,
3636

3737
/// A custom element formatter
38-
pub(crate) element_formatter: Option<Box<dyn Fn(&Bar, &BarChart) -> String>>,
38+
pub(crate) element_formatter: Option<Box<dyn Fn(&Bar, &Self) -> String>>,
3939
}
4040

4141
impl BarChart {

egui_plot/src/items/box_plot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub struct BoxPlot {
3434
default_color: Color32,
3535

3636
/// A custom element formatter
37-
pub(crate) element_formatter: Option<Box<dyn Fn(&BoxElem, &BoxPlot) -> String>>,
37+
pub(crate) element_formatter: Option<Box<dyn Fn(&BoxElem, &Self) -> String>>,
3838
}
3939

4040
impl BoxPlot {

egui_plot/src/items/heatmap.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::ops::RangeInclusive;
2+
use std::sync::Arc;
23

34
use egui::Color32;
45
use egui::Mesh;
@@ -117,7 +118,7 @@ impl Heatmap {
117118
/// `values.len()` is not divisible by `cols`), an empty heatmap is created.
118119
pub fn new(values: Vec<f64>, cols: usize) -> Self {
119120
// Handle invalid parameters by creating an empty heatmap
120-
if cols == 0 || values.is_empty() || (values.len() % cols) != 0 {
121+
if cols == 0 || values.is_empty() || !values.len().is_multiple_of(cols) {
121122
return Self::empty();
122123
}
123124

@@ -329,19 +330,17 @@ impl Heatmap {
329330
fn tile_view_info(&self, ui: &Ui, transform: &PlotTransform, index: usize) -> (Rect, Color32, Shape) {
330331
let v = self.values[index];
331332

332-
// calculate color value
333-
let mut fill_color: Color32;
334-
if let Some(mapping) = &self.custom_mapping {
335-
fill_color = mapping(v);
333+
let mut fill_color = if let Some(mapping) = &self.custom_mapping {
334+
mapping(v)
336335
} else {
337336
// convert to value in [0.0, 1.0]
338337
let v_rel = (v - self.min) / (self.max - self.min);
339338

340339
// convert to color palette index
341340
let palette_index = (v_rel * (self.palette.len() - 1) as f64).round() as usize;
342341

343-
fill_color = self.palette[palette_index];
344-
}
342+
self.palette[palette_index]
343+
};
345344

346345
if self.highlight {
347346
let fill = Rgba::from(fill_color);
@@ -385,7 +384,7 @@ impl Heatmap {
385384
);
386385
let text_pos = tile_rect.center() - galley.size() / 2.0;
387386

388-
let text = Shape::galley(text_pos, galley.clone(), Color32::WHITE);
387+
let text = Shape::galley(text_pos, Arc::clone(&galley), Color32::WHITE);
389388
(tile_rect, fill_color, text)
390389
}
391390
}

egui_plot/src/items/series.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,17 +169,18 @@ impl PlotItem for Line<'_> {
169169
} = self;
170170
let mut fill = *fill;
171171

172-
let mut final_stroke: PathStroke = (*stroke).into();
173-
// if we have a gradient color, we need to wrap the stroke callback to transpose
174-
// the position to a value the caller can reason about
175-
if let Some(gradient_callback) = self.gradient_color.clone() {
172+
let final_stroke: PathStroke = if let Some(gradient_callback) = self.gradient_color.clone() {
173+
// if we have a gradient color, we need to wrap the stroke callback to transpose
174+
// the position to a value the caller can reason about
176175
let local_transform = *transform;
177176
let wrapped_callback = move |_rec: Rect, pos: Pos2| -> Color32 {
178177
let point = local_transform.value_from_position(pos);
179178
gradient_callback(point)
180179
};
181-
final_stroke = PathStroke::new_uv(stroke.width, wrapped_callback.clone());
182-
}
180+
PathStroke::new_uv(stroke.width, wrapped_callback.clone())
181+
} else {
182+
(*stroke).into()
183+
};
183184

184185
let values_tf: Vec<_> = series
185186
.points()

0 commit comments

Comments
 (0)