Skip to content

Commit b1c470b

Browse files
authored
MSRV 1.92 (#271)
1 parent a391241 commit b1c470b

File tree

9 files changed

+99
-89
lines changed

9 files changed

+99
-89
lines changed

Cargo.toml

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ members = ["puffin", "puffin_egui", "puffin_http", "puffin_viewer"]
55
[workspace.package]
66
edition = "2024"
77
license = "MIT OR Apache-2.0"
8-
rust-version = "1.87"
8+
rust-version = "1.92.0"
99

1010
[workspace.dependencies]
1111
anyhow = "1.0.99"
@@ -80,25 +80,33 @@ as_ptr_cast_mut = "warn"
8080
await_holding_lock = "warn"
8181
bool_to_int_with_if = "warn"
8282
branches_sharing_code = "warn"
83-
cast_lossless = "warn"
83+
cast_possible_truncation = "warn" # This might be too much
84+
cast_possible_wrap = "warn"
8485
char_lit_as_u8 = "warn"
8586
checked_conversions = "warn"
8687
clear_with_drain = "warn"
88+
clone_on_ref_ptr = "warn"
8789
cloned_instead_of_copied = "warn"
90+
coerce_container_to_any = "warn"
91+
comparison_chain = "warn"
8892
dbg_macro = "warn"
8993
debug_assert_with_mut_call = "warn"
9094
default_union_representation = "warn"
9195
derive_partial_eq_without_eq = "warn"
92-
disallowed_macros = "warn"
93-
disallowed_methods = "warn"
94-
disallowed_names = "warn"
95-
disallowed_script_idents = "warn"
96-
disallowed_types = "warn"
96+
disallowed_macros = "warn" # See clippy.toml
97+
disallowed_methods = "warn" # See clippy.toml
98+
disallowed_names = "warn" # See clippy.toml
99+
disallowed_script_idents = "warn" # See clippy.toml
100+
disallowed_types = "warn" # See clippy.toml
101+
doc_broken_link = "warn"
102+
doc_comment_double_space_linebreaks = "warn"
103+
doc_include_without_cfg = "warn"
97104
doc_link_with_quotes = "warn"
98105
doc_markdown = "warn"
106+
elidable_lifetime_names = "warn"
99107
empty_enum = "warn"
100-
empty_line_after_outer_attr = "warn"
101108
empty_enum_variants_with_brackets = "warn"
109+
empty_line_after_outer_attr = "warn"
102110
enum_glob_use = "warn"
103111
equatable_if_let = "warn"
104112
exit = "warn"
@@ -115,15 +123,17 @@ fn_to_numeric_cast_any = "warn"
115123
from_iter_instead_of_collect = "warn"
116124
get_unwrap = "warn"
117125
if_let_mutex = "warn"
126+
ignore_without_reason = "warn"
118127
implicit_clone = "warn"
119128
implied_bounds_in_impls = "warn"
120129
imprecise_flops = "warn"
121-
indexing_slicing = "warn"
130+
inconsistent_struct_constructor = "warn"
122131
index_refutable_slice = "warn"
123132
inefficient_to_string = "warn"
124133
infinite_loop = "warn"
125134
into_iter_without_iter = "warn"
126135
invalid_upcast_comparisons = "warn"
136+
ip_constant = "warn"
127137
iter_filter_is_ok = "warn"
128138
iter_filter_is_some = "warn"
129139
iter_not_returning_iterator = "warn"
@@ -132,6 +142,7 @@ iter_on_single_items = "warn"
132142
iter_over_hash_type = "warn"
133143
iter_without_into_iter = "warn"
134144
large_digit_groups = "warn"
145+
large_futures = "warn"
135146
large_include_file = "warn"
136147
large_stack_arrays = "warn"
137148
large_stack_frames = "warn"
@@ -149,11 +160,11 @@ manual_instant_elapsed = "warn"
149160
manual_is_power_of_two = "warn"
150161
manual_is_variant_and = "warn"
151162
manual_let_else = "warn"
163+
manual_midpoint = "warn"
152164
manual_ok_or = "warn"
153165
manual_string_new = "warn"
154166
map_err_ignore = "warn"
155167
map_flatten = "warn"
156-
map_unwrap_or = "warn"
157168
match_bool = "warn"
158169
match_same_arms = "warn"
159170
match_wild_err_arm = "warn"
@@ -164,7 +175,6 @@ missing_assert_message = "warn"
164175
missing_enforced_import_renames = "warn"
165176
missing_errors_doc = "warn"
166177
missing_safety_doc = "warn"
167-
mod_module_files = "warn"
168178
mixed_attributes_style = "warn"
169179
mut_mut = "warn"
170180
mutex_integer = "warn"
@@ -174,12 +184,16 @@ needless_for_each = "warn"
174184
needless_pass_by_ref_mut = "warn"
175185
needless_pass_by_value = "warn"
176186
negative_feature_names = "warn"
187+
non_std_lazy_statics = "warn"
177188
non_zero_suggestions = "warn"
178189
nonstandard_macro_braces = "warn"
190+
only_used_in_recursion = "warn"
179191
option_as_ref_cloned = "warn"
180192
option_option = "warn"
193+
or_fun_call = "warn"
181194
path_buf_push_overwrite = "warn"
182195
pathbuf_init_then_push = "warn"
196+
precedence_bits = "warn"
183197
print_stderr = "warn"
184198
print_stdout = "warn"
185199
ptr_as_ptr = "warn"
@@ -193,20 +207,21 @@ ref_as_ptr = "warn"
193207
ref_option_ref = "warn"
194208
ref_patterns = "warn"
195209
rest_pat_in_fully_bound_structs = "warn"
210+
return_and_then = "warn"
196211
same_functions_in_if_condition = "warn"
212+
self_only_used_in_recursion = "warn"
197213
semicolon_if_nothing_returned = "warn"
198214
set_contains_or_insert = "warn"
199215
should_panic_without_expect = "warn"
200-
significant_drop_tightening = "warn"
201216
single_char_pattern = "warn"
202217
single_match_else = "warn"
218+
single_option_map = "warn"
203219
str_split_at_newline = "warn"
204220
str_to_string = "warn"
205221
string_add = "warn"
206222
string_add_assign = "warn"
207223
string_lit_as_bytes = "warn"
208224
string_lit_chars_any = "warn"
209-
string_to_string = "warn"
210225
suspicious_command_arg_space = "warn"
211226
suspicious_xor_used_as_pow = "warn"
212227
todo = "warn"
@@ -216,19 +231,22 @@ trailing_empty_array = "warn"
216231
trait_duplication_in_bounds = "warn"
217232
transmute_ptr_to_ptr = "warn"
218233
tuple_array_conversions = "warn"
219-
unchecked_duration_subtraction = "warn"
234+
unchecked_time_subtraction = "warn"
220235
undocumented_unsafe_blocks = "warn"
221236
unimplemented = "warn"
222237
uninhabited_references = "warn"
223238
uninlined_format_args = "warn"
224239
unnecessary_box_returns = "warn"
225240
unnecessary_safety_comment = "warn"
241+
unnecessary_debug_formatting = "warn"
226242
unnecessary_literal_bound = "warn"
227243
unnecessary_safety_doc = "warn"
228244
unnecessary_self_imports = "warn"
245+
unnecessary_semicolon = "warn"
229246
unnecessary_struct_initialization = "warn"
230247
unnecessary_wraps = "warn"
231248
unnested_or_patterns = "warn"
249+
unused_async = "warn"
232250
unused_peekable = "warn"
233251
unused_rounding = "warn"
234252
unused_self = "warn"

clippy.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
msrv = "1.87.0"
1+
msrv = "1.92.0"
22

33
avoid-breaking-exported-api = false
44
allow-expect-in-tests = true

puffin/src/profile_view.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,16 @@ impl FrameView {
6767
self.scope_collection.insert(new_scope.clone());
6868
}
6969

70-
if let Some(last) = self.recent.iter().last() {
71-
if new_frame.frame_index() <= last.0.frame_index() {
72-
// A frame from the past!?
73-
// Likely we are `puffin_viewer`, and the server restarted.
74-
// The safe choice is to clear everything:
75-
self.stats.clear();
76-
self.recent.clear();
77-
self.slowest_by_index.clear();
78-
self.slowest_by_duration.clear();
79-
}
70+
if let Some(last) = self.recent.iter().last()
71+
&& new_frame.frame_index() <= last.0.frame_index()
72+
{
73+
// A frame from the past!?
74+
// Likely we are `puffin_viewer`, and the server restarted.
75+
// The safe choice is to clear everything:
76+
self.stats.clear();
77+
self.recent.clear();
78+
self.slowest_by_index.clear();
79+
self.slowest_by_duration.clear();
8080
}
8181

8282
if let Some(last) = self.recent.iter().last() {

puffin/src/utils.rs

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,23 @@ pub fn shorten_rust_function_name(name: &str) -> String {
3838
}
3939

4040
// look for: <some::ConcreteType as some::Trait>::function_name
41-
if let Some(end_caret) = name.rfind('>') {
42-
if let Some(trait_as) = name.rfind(" as ") {
43-
if trait_as < end_caret {
44-
let concrete_name = if let Some(start_caret) = name[..trait_as].rfind('<') {
45-
&name[start_caret + 1..trait_as]
46-
} else {
47-
name
48-
};
49-
50-
let trait_name = &name[trait_as + 4..end_caret];
51-
52-
let concrete_name = last_part(concrete_name);
53-
let trait_name = last_part(trait_name);
54-
55-
let dubcolon_function_name = &name[end_caret + 1..];
56-
return format!("<{concrete_name} as {trait_name}>{dubcolon_function_name}");
57-
}
58-
}
41+
if let Some(end_caret) = name.rfind('>')
42+
&& let Some(trait_as) = name.rfind(" as ")
43+
&& trait_as < end_caret
44+
{
45+
let concrete_name = if let Some(start_caret) = name[..trait_as].rfind('<') {
46+
&name[start_caret + 1..trait_as]
47+
} else {
48+
name
49+
};
50+
51+
let trait_name = &name[trait_as + 4..end_caret];
52+
53+
let concrete_name = last_part(concrete_name);
54+
let trait_name = last_part(trait_name);
55+
56+
let dubcolon_function_name = &name[end_caret + 1..];
57+
return format!("<{concrete_name} as {trait_name}>{dubcolon_function_name}");
5958
}
6059

6160
if let Some(colon) = name.rfind("::") {

puffin_egui/src/flamegraph.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -649,12 +649,12 @@ fn paint_record(
649649
};
650650

651651
if info.response.double_clicked() {
652-
if let Some(mouse_pos) = info.response.interact_pointer_pos() {
653-
if rect.contains(mouse_pos) {
654-
options
655-
.scope_name_filter
656-
.set_filter(scope_details.name().to_string());
657-
}
652+
if let Some(mouse_pos) = info.response.interact_pointer_pos()
653+
&& rect.contains(mouse_pos)
654+
{
655+
options
656+
.scope_name_filter
657+
.set_filter(scope_details.name().to_string());
658658
}
659659
} else if is_hovered && info.response.clicked() {
660660
options.zoom_to_relative_ns_range = Some((
@@ -819,7 +819,7 @@ fn paint_merge_scope(
819819
format!("{}x ", merge.num_pieces)
820820
}
821821
} else {
822-
let is_integral = merge.num_pieces % info.num_frames == 0;
822+
let is_integral = merge.num_pieces.is_multiple_of(info.num_frames);
823823
if is_integral {
824824
format!("{}x ", merge.num_pieces / info.num_frames)
825825
} else {
@@ -939,7 +939,7 @@ fn merge_scope_tooltip(
939939

940940
if merge.num_pieces == num_frames {
941941
ui.monospace("1 call / frame");
942-
} else if merge.num_pieces % num_frames == 0 {
942+
} else if merge.num_pieces.is_multiple_of(num_frames) {
943943
ui.monospace(format!("{} calls / frame", merge.num_pieces / num_frames));
944944
} else {
945945
ui.monospace(format!(

puffin_egui/src/lib.rs

Lines changed: 24 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -279,17 +279,13 @@ pub struct Paused {
279279

280280
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
281281
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
282+
#[derive(Default)]
282283
pub enum View {
284+
#[default]
283285
Flamegraph,
284286
Stats,
285287
}
286288

287-
impl Default for View {
288-
fn default() -> Self {
289-
Self::Flamegraph
290-
}
291-
}
292-
293289
/// Contains settings for the profiler.
294290
#[derive(Clone)]
295291
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
@@ -518,16 +514,16 @@ impl ProfilerUi {
518514
|| space_pressed
519515
{
520516
let latest = frame_view.latest_frame();
521-
if let Some(latest) = latest {
522-
if let Ok(latest) = latest.unpacked() {
523-
self.pause_and_select(
524-
frame_view,
525-
SelectedFrames::from_vec1(
526-
frame_view.scope_collection(),
527-
vec1::vec1![latest],
528-
),
529-
);
530-
}
517+
if let Some(latest) = latest
518+
&& let Ok(latest) = latest.unpacked()
519+
{
520+
self.pause_and_select(
521+
frame_view,
522+
SelectedFrames::from_vec1(
523+
frame_view.scope_collection(),
524+
vec1::vec1![latest],
525+
),
526+
);
531527
}
532528
}
533529
});
@@ -649,10 +645,10 @@ impl ProfilerUi {
649645
ui.style_mut().wrap_mode = Some(TextWrapMode::Extend);
650646
ui.add_space(16.0); // make it a bit more centered
651647
ui.label("Slowest:");
652-
if let Some(frame_view) = frame_view.as_mut() {
653-
if ui.button("Clear").clicked() {
654-
frame_view.clear_slowest();
655-
}
648+
if let Some(frame_view) = frame_view.as_mut()
649+
&& ui.button("Clear").clicked()
650+
{
651+
frame_view.clear_slowest();
656652
}
657653
});
658654

@@ -761,18 +757,15 @@ impl ProfilerUi {
761757
});
762758
}
763759

764-
if response.dragged() {
765-
if let (Some(start), Some(curr)) =
760+
if response.dragged()
761+
&& let (Some(start), Some(curr)) =
766762
ui.input(|i| (i.pointer.press_origin(), i.pointer.interact_pos()))
767-
{
768-
let min_x = start.x.min(curr.x);
769-
let max_x = start.x.max(curr.x);
770-
let intersects = min_x <= frame_rect.right() && frame_rect.left() <= max_x;
771-
if intersects {
772-
if let Ok(frame) = frame.unpacked() {
773-
new_selection.push(frame);
774-
}
775-
}
763+
{
764+
let min_x = start.x.min(curr.x);
765+
let max_x = start.x.max(curr.x);
766+
let intersects = min_x <= frame_rect.right() && frame_rect.left() <= max_x;
767+
if intersects && let Ok(frame) = frame.unpacked() {
768+
new_selection.push(frame);
776769
}
777770
}
778771

puffin_http/src/client.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ impl Client {
3939

4040
let client = Self {
4141
addr: addr.clone(),
42-
connected: connected.clone(),
43-
alive: alive.clone(),
44-
frame_view: frame_view.clone(),
42+
connected: Arc::clone(&connected),
43+
alive: Arc::clone(&alive),
44+
frame_view: Arc::clone(&frame_view),
4545
};
4646

4747
let _: std::thread::JoinHandle<()> = std::thread::Builder::new()

0 commit comments

Comments
 (0)