Skip to content

Commit b2c07d6

Browse files
authored
fix: Fix clippy warnings introduced in 1.89 (#606)
1 parent e9dee2a commit b2c07d6

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

common/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2105,6 +2105,7 @@ vec_property_methods! {
21052105
#[cfg(test)]
21062106
mod custom_actions {
21072107
use super::{CustomAction, Node, Role};
2108+
use core::slice;
21082109

21092110
#[test]
21102111
fn getter_should_return_default_value() {
@@ -2139,7 +2140,7 @@ mod custom_actions {
21392140
description: "second test action".into(),
21402141
};
21412142
node.push_custom_action(first_action.clone());
2142-
assert_eq!(node.custom_actions(), &[first_action.clone()]);
2143+
assert_eq!(node.custom_actions(), slice::from_ref(&first_action));
21432144
node.push_custom_action(second_action.clone());
21442145
assert_eq!(node.custom_actions(), &[first_action, second_action]);
21452146
}

consumer/src/text.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ impl<'a> Position<'a> {
196196
self.inner.downgrade()
197197
}
198198

199-
pub fn inner_node(&self) -> &Node {
199+
pub fn inner_node(&self) -> &Node<'a> {
200200
&self.inner.node
201201
}
202202

@@ -520,7 +520,7 @@ impl<'a> Range<'a> {
520520
Self { node, start, end }
521521
}
522522

523-
pub fn node(&self) -> &Node {
523+
pub fn node(&self) -> &Node<'a> {
524524
&self.node
525525
}
526526

@@ -913,7 +913,7 @@ impl<'a> Node<'a> {
913913
}
914914
}
915915

916-
pub fn document_range(&self) -> Range {
916+
pub fn document_range(&self) -> Range<'_> {
917917
let start = self.document_start();
918918
let end = self.document_end();
919919
Range::new(*self, start, end)
@@ -923,15 +923,15 @@ impl<'a> Node<'a> {
923923
self.data().text_selection().is_some()
924924
}
925925

926-
pub fn text_selection(&self) -> Option<Range> {
926+
pub fn text_selection(&self) -> Option<Range<'_>> {
927927
self.data().text_selection().map(|selection| {
928928
let anchor = InnerPosition::clamped_upgrade(self.tree_state, selection.anchor).unwrap();
929929
let focus = InnerPosition::clamped_upgrade(self.tree_state, selection.focus).unwrap();
930930
Range::new(*self, anchor, focus)
931931
})
932932
}
933933

934-
pub fn text_selection_anchor(&self) -> Option<Position> {
934+
pub fn text_selection_anchor(&self) -> Option<Position<'_>> {
935935
self.data().text_selection().map(|selection| {
936936
let anchor = InnerPosition::clamped_upgrade(self.tree_state, selection.anchor).unwrap();
937937
Position {
@@ -941,7 +941,7 @@ impl<'a> Node<'a> {
941941
})
942942
}
943943

944-
pub fn text_selection_focus(&self) -> Option<Position> {
944+
pub fn text_selection_focus(&self) -> Option<Position<'_>> {
945945
self.data().text_selection().map(|selection| {
946946
let focus = InnerPosition::clamped_upgrade(self.tree_state, selection.focus).unwrap();
947947
Position {
@@ -953,7 +953,7 @@ impl<'a> Node<'a> {
953953

954954
/// Returns the nearest text position to the given point
955955
/// in this node's coordinate space.
956-
pub fn text_position_at_point(&self, point: Point) -> Position {
956+
pub fn text_position_at_point(&self, point: Point) -> Position<'_> {
957957
let id = self.id();
958958
if let Some((node, point)) = self.hit_test(point, &move |node| text_node_filter(id, node)) {
959959
if node.role() == Role::TextRun {
@@ -1022,7 +1022,7 @@ impl<'a> Node<'a> {
10221022
}
10231023
}
10241024

1025-
pub fn line_range_from_index(&self, line_index: usize) -> Option<Range> {
1025+
pub fn line_range_from_index(&self, line_index: usize) -> Option<Range<'_>> {
10261026
let mut pos = self.document_range().start();
10271027

10281028
if line_index > 0 {
@@ -1045,7 +1045,7 @@ impl<'a> Node<'a> {
10451045
Some(Range::new(*self, pos.inner, end.inner))
10461046
}
10471047

1048-
pub fn text_position_from_global_usv_index(&self, index: usize) -> Option<Position> {
1048+
pub fn text_position_from_global_usv_index(&self, index: usize) -> Option<Position<'_>> {
10491049
let mut total_length = 0usize;
10501050
for node in self.text_runs() {
10511051
let node_text = node.data().value().unwrap();
@@ -1087,7 +1087,7 @@ impl<'a> Node<'a> {
10871087
None
10881088
}
10891089

1090-
pub fn text_position_from_global_utf16_index(&self, index: usize) -> Option<Position> {
1090+
pub fn text_position_from_global_utf16_index(&self, index: usize) -> Option<Position<'_>> {
10911091
let mut total_length = 0usize;
10921092
for node in self.text_runs() {
10931093
let node_text = node.data().value().unwrap();

platforms/atspi-common/src/adapter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ impl Adapter {
579579
}
580580
}
581581

582-
fn root_window(current_state: &TreeState) -> Option<Node> {
582+
fn root_window(current_state: &TreeState) -> Option<Node<'_>> {
583583
const WINDOW_ROLES: &[Role] = &[Role::AlertDialog, Role::Dialog, Role::Window];
584584
let root = current_state.root();
585585
if WINDOW_ROLES.contains(&root.role()) {

0 commit comments

Comments
 (0)