parent
e9afd3c52d
commit
ef039aa566
14
Cargo.toml
14
Cargo.toml
|
|
@ -136,16 +136,20 @@ broken_intra_doc_links = "warn"
|
||||||
|
|
||||||
# See also clippy.toml
|
# See also clippy.toml
|
||||||
[workspace.lints.clippy]
|
[workspace.lints.clippy]
|
||||||
|
all = { level = "warn", priority = -1 }
|
||||||
|
|
||||||
allow_attributes = "warn"
|
allow_attributes = "warn"
|
||||||
as_ptr_cast_mut = "warn"
|
as_ptr_cast_mut = "warn"
|
||||||
await_holding_lock = "warn"
|
await_holding_lock = "warn"
|
||||||
bool_to_int_with_if = "warn"
|
bool_to_int_with_if = "warn"
|
||||||
|
branches_sharing_code = "warn"
|
||||||
char_lit_as_u8 = "warn"
|
char_lit_as_u8 = "warn"
|
||||||
checked_conversions = "warn"
|
checked_conversions = "warn"
|
||||||
clear_with_drain = "warn"
|
clear_with_drain = "warn"
|
||||||
cloned_instead_of_copied = "warn"
|
cloned_instead_of_copied = "warn"
|
||||||
dbg_macro = "warn"
|
dbg_macro = "warn"
|
||||||
debug_assert_with_mut_call = "warn"
|
debug_assert_with_mut_call = "warn"
|
||||||
|
default_union_representation = "warn"
|
||||||
derive_partial_eq_without_eq = "warn"
|
derive_partial_eq_without_eq = "warn"
|
||||||
disallowed_macros = "warn" # See clippy.toml
|
disallowed_macros = "warn" # See clippy.toml
|
||||||
disallowed_methods = "warn" # See clippy.toml
|
disallowed_methods = "warn" # See clippy.toml
|
||||||
|
|
@ -155,6 +159,7 @@ disallowed_types = "warn" # See clippy.toml
|
||||||
doc_link_with_quotes = "warn"
|
doc_link_with_quotes = "warn"
|
||||||
doc_markdown = "warn"
|
doc_markdown = "warn"
|
||||||
empty_enum = "warn"
|
empty_enum = "warn"
|
||||||
|
empty_line_after_outer_attr = "warn"
|
||||||
empty_enum_variants_with_brackets = "warn"
|
empty_enum_variants_with_brackets = "warn"
|
||||||
enum_glob_use = "warn"
|
enum_glob_use = "warn"
|
||||||
equatable_if_let = "warn"
|
equatable_if_let = "warn"
|
||||||
|
|
@ -171,6 +176,7 @@ fn_params_excessive_bools = "warn"
|
||||||
fn_to_numeric_cast_any = "warn"
|
fn_to_numeric_cast_any = "warn"
|
||||||
from_iter_instead_of_collect = "warn"
|
from_iter_instead_of_collect = "warn"
|
||||||
get_unwrap = "warn"
|
get_unwrap = "warn"
|
||||||
|
if_let_mutex = "warn"
|
||||||
implicit_clone = "warn"
|
implicit_clone = "warn"
|
||||||
implied_bounds_in_impls = "warn"
|
implied_bounds_in_impls = "warn"
|
||||||
imprecise_flops = "warn"
|
imprecise_flops = "warn"
|
||||||
|
|
@ -211,6 +217,7 @@ match_same_arms = "warn"
|
||||||
match_wild_err_arm = "warn"
|
match_wild_err_arm = "warn"
|
||||||
match_wildcard_for_single_variants = "warn"
|
match_wildcard_for_single_variants = "warn"
|
||||||
mem_forget = "warn"
|
mem_forget = "warn"
|
||||||
|
mismatched_target_os = "warn"
|
||||||
mismatching_type_param_order = "warn"
|
mismatching_type_param_order = "warn"
|
||||||
missing_assert_message = "warn"
|
missing_assert_message = "warn"
|
||||||
missing_enforced_import_renames = "warn"
|
missing_enforced_import_renames = "warn"
|
||||||
|
|
@ -230,8 +237,9 @@ nonstandard_macro_braces = "warn"
|
||||||
option_as_ref_cloned = "warn"
|
option_as_ref_cloned = "warn"
|
||||||
option_option = "warn"
|
option_option = "warn"
|
||||||
path_buf_push_overwrite = "warn"
|
path_buf_push_overwrite = "warn"
|
||||||
print_stderr = "warn"
|
|
||||||
pathbuf_init_then_push = "warn"
|
pathbuf_init_then_push = "warn"
|
||||||
|
print_stderr = "warn"
|
||||||
|
print_stdout = "warn"
|
||||||
ptr_as_ptr = "warn"
|
ptr_as_ptr = "warn"
|
||||||
ptr_cast_constness = "warn"
|
ptr_cast_constness = "warn"
|
||||||
pub_underscore_fields = "warn"
|
pub_underscore_fields = "warn"
|
||||||
|
|
@ -261,6 +269,7 @@ todo = "warn"
|
||||||
too_long_first_doc_paragraph = "warn"
|
too_long_first_doc_paragraph = "warn"
|
||||||
trailing_empty_array = "warn"
|
trailing_empty_array = "warn"
|
||||||
trait_duplication_in_bounds = "warn"
|
trait_duplication_in_bounds = "warn"
|
||||||
|
transmute_ptr_to_ptr = "warn"
|
||||||
tuple_array_conversions = "warn"
|
tuple_array_conversions = "warn"
|
||||||
unchecked_duration_subtraction = "warn"
|
unchecked_duration_subtraction = "warn"
|
||||||
undocumented_unsafe_blocks = "warn"
|
undocumented_unsafe_blocks = "warn"
|
||||||
|
|
@ -268,8 +277,10 @@ unimplemented = "warn"
|
||||||
uninhabited_references = "warn"
|
uninhabited_references = "warn"
|
||||||
uninlined_format_args = "warn"
|
uninlined_format_args = "warn"
|
||||||
unnecessary_box_returns = "warn"
|
unnecessary_box_returns = "warn"
|
||||||
|
unnecessary_safety_comment = "warn"
|
||||||
unnecessary_literal_bound = "warn"
|
unnecessary_literal_bound = "warn"
|
||||||
unnecessary_safety_doc = "warn"
|
unnecessary_safety_doc = "warn"
|
||||||
|
unnecessary_self_imports = "warn"
|
||||||
unnecessary_struct_initialization = "warn"
|
unnecessary_struct_initialization = "warn"
|
||||||
unnecessary_wraps = "warn"
|
unnecessary_wraps = "warn"
|
||||||
unnested_or_patterns = "warn"
|
unnested_or_patterns = "warn"
|
||||||
|
|
@ -278,6 +289,7 @@ unused_rounding = "warn"
|
||||||
unused_self = "warn"
|
unused_self = "warn"
|
||||||
unused_trait_names = "warn"
|
unused_trait_names = "warn"
|
||||||
use_self = "warn"
|
use_self = "warn"
|
||||||
|
useless_let_if_seq = "warn"
|
||||||
useless_transmute = "warn"
|
useless_transmute = "warn"
|
||||||
verbose_file_reads = "warn"
|
verbose_file_reads = "warn"
|
||||||
wildcard_dependencies = "warn"
|
wildcard_dependencies = "warn"
|
||||||
|
|
|
||||||
|
|
@ -468,6 +468,8 @@ fn should_prioritize_hits_on_back(back: Rect, front: Rect) -> bool {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
#![expect(clippy::print_stdout)]
|
||||||
|
|
||||||
use emath::{Rect, pos2, vec2};
|
use emath::{Rect, pos2, vec2};
|
||||||
|
|
||||||
use crate::{Id, Sense};
|
use crate::{Id, Sense};
|
||||||
|
|
|
||||||
|
|
@ -648,6 +648,8 @@ impl ViewportBuilder {
|
||||||
/// returning a list of commands and a bool indicating if the window needs to be recreated.
|
/// returning a list of commands and a bool indicating if the window needs to be recreated.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn patch(&mut self, new_vp_builder: Self) -> (Vec<ViewportCommand>, bool) {
|
pub fn patch(&mut self, new_vp_builder: Self) -> (Vec<ViewportCommand>, bool) {
|
||||||
|
#![expect(clippy::useless_let_if_seq)] // False positive
|
||||||
|
|
||||||
let Self {
|
let Self {
|
||||||
title: new_title,
|
title: new_title,
|
||||||
app_id: new_app_id,
|
app_id: new_app_id,
|
||||||
|
|
|
||||||
|
|
@ -422,10 +422,12 @@ impl RichText {
|
||||||
font_id
|
font_id
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut background_color = background_color;
|
let background_color = if code {
|
||||||
if code {
|
style.visuals.code_bg_color
|
||||||
background_color = style.visuals.code_bg_color;
|
} else {
|
||||||
}
|
background_color
|
||||||
|
};
|
||||||
|
|
||||||
let underline = if underline {
|
let underline = if underline {
|
||||||
crate::Stroke::new(1.0, line_color)
|
crate::Stroke::new(1.0, line_color)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -938,11 +938,9 @@ fn animated_image_frame_index(ctx: &Context, uri: &str) -> usize {
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
0
|
|
||||||
} else {
|
|
||||||
0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
0
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Checks if uri is a gif file
|
/// Checks if uri is a gif file
|
||||||
|
|
|
||||||
|
|
@ -929,12 +929,10 @@ fn events(
|
||||||
event if cursor_range.on_event(os, event, galley, id) => None,
|
event if cursor_range.on_event(os, event, galley, id) => None,
|
||||||
|
|
||||||
Event::Copy => {
|
Event::Copy => {
|
||||||
if cursor_range.is_empty() {
|
if !cursor_range.is_empty() {
|
||||||
None
|
|
||||||
} else {
|
|
||||||
copy_if_not_password(ui, cursor_range.slice_str(text.as_str()).to_owned());
|
copy_if_not_password(ui, cursor_range.slice_str(text.as_str()).to_owned());
|
||||||
None
|
|
||||||
}
|
}
|
||||||
|
None
|
||||||
}
|
}
|
||||||
Event::Cut => {
|
Event::Cut => {
|
||||||
if cursor_range.is_empty() {
|
if cursor_range.is_empty() {
|
||||||
|
|
|
||||||
|
|
@ -321,6 +321,8 @@ fn try_image_snapshot_options_impl(
|
||||||
name: String,
|
name: String,
|
||||||
options: &SnapshotOptions,
|
options: &SnapshotOptions,
|
||||||
) -> SnapshotResult {
|
) -> SnapshotResult {
|
||||||
|
#![expect(clippy::print_stdout)]
|
||||||
|
|
||||||
let SnapshotOptions {
|
let SnapshotOptions {
|
||||||
threshold,
|
threshold,
|
||||||
output_path,
|
output_path,
|
||||||
|
|
|
||||||
|
|
@ -830,6 +830,7 @@ mod tests {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[expect(clippy::print_stdout)]
|
||||||
#[test]
|
#[test]
|
||||||
fn test_ray_intersection() {
|
fn test_ray_intersection() {
|
||||||
let rect = Rect::from_min_max(pos2(1.0, 1.0), pos2(3.0, 3.0));
|
let rect = Rect::from_min_max(pos2(1.0, 1.0), pos2(3.0, 3.0));
|
||||||
|
|
|
||||||
|
|
@ -613,6 +613,8 @@ struct FlatteningParameters {
|
||||||
impl FlatteningParameters {
|
impl FlatteningParameters {
|
||||||
// https://raphlinus.github.io/graphics/curves/2019/12/23/flatten-quadbez.html
|
// https://raphlinus.github.io/graphics/curves/2019/12/23/flatten-quadbez.html
|
||||||
pub fn from_curve(curve: &QuadraticBezierShape, tolerance: f32) -> Self {
|
pub fn from_curve(curve: &QuadraticBezierShape, tolerance: f32) -> Self {
|
||||||
|
#![expect(clippy::useless_let_if_seq)]
|
||||||
|
|
||||||
// Map the quadratic bézier segment to y = x^2 parabola.
|
// Map the quadratic bézier segment to y = x^2 parabola.
|
||||||
let from = curve.points[0];
|
let from = curve.points[0];
|
||||||
let ctrl = curve.points[1];
|
let ctrl = curve.points[1];
|
||||||
|
|
|
||||||
|
|
@ -1165,6 +1165,7 @@ mod tests {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[expect(clippy::print_stdout)]
|
||||||
#[test]
|
#[test]
|
||||||
fn test_split_paragraphs() {
|
fn test_split_paragraphs() {
|
||||||
for pixels_per_point in [1.0, 2.0_f32.sqrt(), 2.0] {
|
for pixels_per_point in [1.0, 2.0_f32.sqrt(), 2.0] {
|
||||||
|
|
|
||||||
|
|
@ -554,6 +554,8 @@ fn halign_and_justify_row(
|
||||||
wrap_width: f32,
|
wrap_width: f32,
|
||||||
justify: bool,
|
justify: bool,
|
||||||
) {
|
) {
|
||||||
|
#![expect(clippy::useless_let_if_seq)] // False positive
|
||||||
|
|
||||||
let row = Arc::make_mut(&mut placed_row.row);
|
let row = Arc::make_mut(&mut placed_row.row);
|
||||||
|
|
||||||
if row.glyphs.is_empty() {
|
if row.glyphs.is_empty() {
|
||||||
|
|
|
||||||
|
|
@ -179,8 +179,8 @@ impl Keypad {
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
let mut is_first_show = false;
|
let is_first_show = ctx.wants_keyboard_input() && state.focus != focus;
|
||||||
if ctx.wants_keyboard_input() && state.focus != focus {
|
if is_first_show {
|
||||||
let y = ctx.style().spacing.interact_size.y * 1.25;
|
let y = ctx.style().spacing.interact_size.y * 1.25;
|
||||||
state.open = true;
|
state.open = true;
|
||||||
state.start_pos = ctx.input(|i| {
|
state.start_pos = ctx.input(|i| {
|
||||||
|
|
@ -189,7 +189,6 @@ impl Keypad {
|
||||||
.map_or(pos2(100.0, 100.0), |p| p + vec2(0.0, y))
|
.map_or(pos2(100.0, 100.0), |p| p + vec2(0.0, y))
|
||||||
});
|
});
|
||||||
state.focus = focus;
|
state.focus = focus;
|
||||||
is_first_show = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if state.close_on_next_frame {
|
if state.close_on_next_frame {
|
||||||
|
|
|
||||||
|
|
@ -11,5 +11,6 @@ fn main() -> std::io::Result<()> {
|
||||||
// Do not check `app` on unsupported platforms when check "--all-features" is used in CI.
|
// Do not check `app` on unsupported platforms when check "--all-features" is used in CI.
|
||||||
#[cfg(not(target_os = "linux"))]
|
#[cfg(not(target_os = "linux"))]
|
||||||
fn main() {
|
fn main() {
|
||||||
|
#![expect(clippy::print_stdout)]
|
||||||
println!("This example only supports Linux.");
|
println!("This example only supports Linux.");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue