summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorAlexandru Macovei <alexnmaco@gmail.com>2022-10-19 14:45:12 +0300
committerGitHub <noreply@github.com>2022-10-19 13:45:12 +0200
commit6b5745f6c24e11b2def9df13aa49c74fb6ba187a (patch)
treef1aac11b6f2cbc0909e883788997021addd0b3a3 /src/ui
parente2a0f3800fa57d53d462f99da575e5538ea85cdb (diff)
Fix Clippy Lints (#1390)
* apply latest nigtly clippy lints * temporarily disable const fn lints due to nigh false positive count on nightly
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/mod.rs4
-rw-r--r--src/ui/reflow.rs8
2 files changed, 6 insertions, 6 deletions
diff --git a/src/ui/mod.rs b/src/ui/mod.rs
index cee73105..8f11dc9b 100644
--- a/src/ui/mod.rs
+++ b/src/ui/mod.rs
@@ -87,8 +87,8 @@ pub fn centered_rect(
/// makes sure Rect `r` at least stays as big as min and not bigger than max
pub fn rect_inside(min: Size, max: Size, r: Rect) -> Rect {
- let new_width = r.width.max(min.width).min(max.width);
- let new_height = r.height.max(min.height).min(max.height);
+ let new_width = r.width.clamp(min.width, max.width);
+ let new_height = r.height.clamp(min.height, max.height);
let diff_width = new_width.saturating_sub(r.width);
let diff_height = new_height.saturating_sub(r.height);
diff --git a/src/ui/reflow.rs b/src/ui/reflow.rs
index b2417867..a9937361 100644
--- a/src/ui/reflow.rs
+++ b/src/ui/reflow.rs
@@ -442,7 +442,7 @@ mod test {
assert_eq!(line_truncator, vec!["", "a"]);
}
- /// Tests WordWrapper with words some of which exceed line length and some not.
+ /// Tests `WordWrapper` with words some of which exceed line length and some not.
#[test]
fn line_composer_word_wrapper_mixed_length() {
let width = 20;
@@ -471,11 +471,11 @@ mod test {
では、";
let (word_wrapper, word_wrapper_width) = run_composer(
Composer::WordWrapper { trim: true },
- &text,
+ text,
width,
);
let (line_truncator, _) =
- run_composer(Composer::LineTruncator, &text, width);
+ run_composer(Composer::LineTruncator, text, width);
assert_eq!(line_truncator, vec!["コンピュータ上で文字"]);
let wrapped = vec![
"コンピュータ上で文字",
@@ -592,7 +592,7 @@ mod test {
);
// Ensure that if the character was a regular space, it would be wrapped differently.
- let text_space = text.replace("\u{00a0}", " ");
+ let text_space = text.replace('\u{00a0}', " ");
let (word_wrapper_space, _) = run_composer(
Composer::WordWrapper { trim: true },
&text_space,