Skip to content

Commit 0ff0261

Browse files
committed
clippy fixes
1 parent 6df971d commit 0ff0261

File tree

4 files changed

+11
-14
lines changed

4 files changed

+11
-14
lines changed

crates/bevy_text/src/pipeline.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ impl TextPipeline {
220220
computed.needs_rerender = false;
221221

222222
// Extract font ids from the iterator while traversing it.
223-
let mut glyph_info = std::mem::take(&mut self.glyph_info);
223+
let mut glyph_info = core::mem::take(&mut self.glyph_info);
224224
glyph_info.clear();
225225
let text_spans = text_spans.inspect(|(_, _, _, style)| {
226226
glyph_info.push((style.font.id(), style.font_smoothing));

crates/bevy_text/src/text.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ pub fn detect_text_needs_rerender<Root: Component>(
394394
for root in changed_roots.iter() {
395395
let Ok((_, Some(mut computed), _)) = computed.get_mut(root) else {
396396
warn_once!("found entity {:?} with a root text component ({}) but no ComputedTextBlock; this warning only \
397-
prints once", root, std::any::type_name::<Root>());
397+
prints once", root, core::any::type_name::<Root>());
398398
continue;
399399
};
400400
computed.needs_rerender = true;
@@ -408,15 +408,15 @@ pub fn detect_text_needs_rerender<Root: Component>(
408408
if has_text_block {
409409
warn_once!("found entity {:?} with a TextSpan that has a TextBlock, which should only be on root \
410410
text entities (that have {}); this warning only prints once",
411-
entity, std::any::type_name::<Root>());
411+
entity, core::any::type_name::<Root>());
412412
}
413413

414414
let Some(span_parent) = maybe_span_parent else {
415415
warn_once!(
416416
"found entity {:?} with a TextSpan that has no parent; it should have an ancestor \
417417
with a root text component ({}); this warning only prints once",
418418
entity,
419-
std::any::type_name::<Root>()
419+
core::any::type_name::<Root>()
420420
);
421421
continue;
422422
};
@@ -447,7 +447,7 @@ pub fn detect_text_needs_rerender<Root: Component>(
447447
"found entity {:?} with a TextSpan that has no ancestor with the root text \
448448
component ({}); this warning only prints once",
449449
entity,
450-
std::any::type_name::<Root>()
450+
core::any::type_name::<Root>()
451451
);
452452
break;
453453
};

crates/bevy_text/src/text_access.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub(crate) struct TextIterScratch {
2626
}
2727

2828
impl TextIterScratch {
29-
fn take<'a, 'b>(&'a mut self) -> Vec<(&'b Children, usize)> {
29+
fn take<'a>(&mut self) -> Vec<(&'a Children, usize)> {
3030
core::mem::take(&mut self.stack)
3131
.into_iter()
3232
.map(|_| -> (&Children, usize) { unreachable!() })
@@ -62,7 +62,7 @@ pub struct TextReader<'w, 's, R: TextRoot> {
6262

6363
impl<'w, 's, R: TextRoot> TextReader<'w, 's, R> {
6464
/// Returns an iterator over text spans in a text block, starting with the root entity.
65-
pub fn iter<'a>(&'a mut self, root_entity: Entity) -> TextSpanIter<'a, R> {
65+
pub fn iter(&mut self, root_entity: Entity) -> TextSpanIter<R> {
6666
let stack = self.scratch.take();
6767

6868
TextSpanIter {
@@ -141,16 +141,13 @@ impl<'a, R: TextRoot> Iterator for TextSpanIter<'a, R> {
141141
self.stack.push((children, 0));
142142
}
143143
return Some((root_entity, 0, text.read_span(), style));
144-
} else {
145-
return None;
146144
}
145+
return None;
147146
}
148147

149148
// Span
150149
loop {
151-
let Some((children, idx)) = self.stack.last_mut() else {
152-
return None;
153-
};
150+
let (children, idx) = self.stack.last_mut()?;
154151

155152
loop {
156153
let Some(child) = children.get(*idx) else {
@@ -181,7 +178,7 @@ impl<'a, R: TextRoot> Iterator for TextSpanIter<'a, R> {
181178
impl<'a, R: TextRoot> Drop for TextSpanIter<'a, R> {
182179
fn drop(&mut self) {
183180
// Return the internal stack.
184-
let stack = std::mem::take(&mut self.stack);
181+
let stack = core::mem::take(&mut self.stack);
185182
self.scratch.recover(stack);
186183
}
187184
}

crates/bevy_ui/src/accessibility.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ fn calc_name(
2828
.iter(child)
2929
.map(|(_, _, text, _)| text.into())
3030
.collect::<Vec<String>>();
31-
if values.len() > 0 {
31+
if !values.is_empty() {
3232
name = Some(values.join(" "));
3333
}
3434
}

0 commit comments

Comments
 (0)