mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
clippy: fix warnings in components/shared (#31565)
* clippy: fix some warnings in components/shared * fix: unit tests * fix: review comments
This commit is contained in:
parent
3a5ca785d3
commit
43f44965cd
14 changed files with 102 additions and 139 deletions
|
@ -25,9 +25,9 @@ impl Epoch {
|
|||
}
|
||||
}
|
||||
|
||||
impl Into<WebRenderEpoch> for Epoch {
|
||||
fn into(self) -> WebRenderEpoch {
|
||||
WebRenderEpoch(self.0)
|
||||
impl From<Epoch> for WebRenderEpoch {
|
||||
fn from(val: Epoch) -> Self {
|
||||
WebRenderEpoch(val.0)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ pub fn combine_id_with_fragment_type(id: usize, fragment_type: FragmentType) ->
|
|||
|
||||
pub fn node_id_from_scroll_id(id: usize) -> Option<usize> {
|
||||
if (id & !SPECIAL_SCROLL_ROOT_ID_MASK) != 0 {
|
||||
return Some((id & !3) as usize);
|
||||
return Some(id & !3);
|
||||
}
|
||||
None
|
||||
}
|
||||
|
|
|
@ -28,17 +28,17 @@ impl PrintTree {
|
|||
|
||||
self.print_level_prefix();
|
||||
|
||||
let items: Vec<&str> = queued_title.split("\n").collect();
|
||||
let items: Vec<&str> = queued_title.split('\n').collect();
|
||||
println!("\u{251C}\u{2500} {}", items[0]);
|
||||
for i in 1..items.len() {
|
||||
self.print_level_child_indentation();
|
||||
print!("{}", items[i]);
|
||||
if i < items.len() {
|
||||
print!("\n");
|
||||
println!();
|
||||
}
|
||||
}
|
||||
|
||||
self.level = self.level + 1;
|
||||
self.level += 1;
|
||||
}
|
||||
|
||||
/// Ascend one level in the tree.
|
||||
|
@ -69,13 +69,13 @@ impl PrintTree {
|
|||
fn flush_queued_item(&mut self, prefix: &str) {
|
||||
if let Some(queued_item) = self.queued_item.take() {
|
||||
self.print_level_prefix();
|
||||
let items: Vec<&str> = queued_item.split("\n").collect();
|
||||
let items: Vec<&str> = queued_item.split('\n').collect();
|
||||
println!("{} {}", prefix, items[0]);
|
||||
for i in 1..items.len() {
|
||||
self.print_level_child_indentation();
|
||||
print!("{}", items[i]);
|
||||
if i < items.len() {
|
||||
print!("\n");
|
||||
println!();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue