summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-02-04 12:35:10 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-02-24 13:31:19 +0100
commit17470bf7d36ee164311020b9d8c79662ac49c166 (patch)
tree6ab9c891220d3fc0bbce662a6d713046f5031062
parentd2825360a75600bb6b4097737c987e2d9e05da6a (diff)
downloadiced-17470bf7d36ee164311020b9d8c79662ac49c166.tar.gz
iced-17470bf7d36ee164311020b9d8c79662ac49c166.tar.bz2
iced-17470bf7d36ee164311020b9d8c79662ac49c166.zip
Fix `clippy` lints :tada:
-rw-r--r--native/src/widget/text_input.rs2
-rw-r--r--wgpu/src/text.rs13
2 files changed, 8 insertions, 7 deletions
diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs
index e6b70db2..0656be62 100644
--- a/native/src/widget/text_input.rs
+++ b/native/src/widget/text_input.rs
@@ -967,7 +967,7 @@ pub fn draw<Renderer>(
} else {
theme.value_color(style)
},
- font: font,
+ font,
bounds: Rectangle {
y: text_bounds.center_y(),
width: f32::INFINITY,
diff --git a/wgpu/src/text.rs b/wgpu/src/text.rs
index 4af57af3..967596f2 100644
--- a/wgpu/src/text.rs
+++ b/wgpu/src/text.rs
@@ -7,6 +7,7 @@ use iced_native::{Color, Font, Rectangle, Size};
use rustc_hash::{FxHashMap, FxHashSet};
use std::borrow::Cow;
use std::cell::RefCell;
+use std::collections::hash_map;
use std::hash::{BuildHasher, Hash, Hasher};
use std::sync::Arc;
use twox_hash::RandomXxHashBuilder64;
@@ -70,7 +71,7 @@ impl Pipeline {
let (locale, mut db) = heads.fonts.into_locale_and_db();
db.load_font_source(glyphon::fontdb::Source::Binary(Arc::new(
- bytes.to_owned(),
+ bytes.into_owned(),
)));
self.system = Some(
@@ -241,7 +242,7 @@ impl Pipeline {
fields.fonts,
Key {
content,
- size: size,
+ size,
font,
bounds,
color: Color::BLACK,
@@ -275,7 +276,7 @@ impl Pipeline {
fields.fonts,
Key {
content,
- size: size,
+ size,
font,
bounds,
color: Color::BLACK,
@@ -344,9 +345,9 @@ impl<'a> Cache<'a> {
hasher.finish()
};
- if !self.entries.contains_key(&hash) {
+ if let hash_map::Entry::Vacant(entry) = self.entries.entry(hash) {
let metrics = glyphon::Metrics::new(key.size, key.size * 1.2);
- let mut buffer = glyphon::Buffer::new(&fonts, metrics);
+ let mut buffer = glyphon::Buffer::new(fonts, metrics);
buffer.set_size(key.bounds.width, key.bounds.height);
buffer.set_text(
@@ -363,7 +364,7 @@ impl<'a> Cache<'a> {
}),
);
- let _ = self.entries.insert(hash, buffer);
+ let _ = entry.insert(buffer);
}
let _ = self.recently_used.insert(hash);