Skip to content

Commit 3c23424

Browse files
authored
Merge pull request #88 from element-hq/langleyd/update-rust-190
Update rust to 1.90 (stable)
2 parents 4615e8a + 0b2d20b commit 3c23424

File tree

7 files changed

+35
-38
lines changed

7 files changed

+35
-38
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ default-members = [
1313
resolver = "2"
1414

1515
[workspace.package]
16-
rust-version = "1.83"
16+
rust-version = "1.90"
1717
license-file = "README.md"
1818

1919
[workspace.dependencies]

crates/wysiwyg/src/composer_model/lists.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ where
183183
) -> ComposerUpdate<S> {
184184
let list_loc_in_range =
185185
range.locations.iter().find(|l| l.kind == DomNodeKind::List);
186-
let list_is_before_selection = list_loc_in_range.map_or(false, |l| {
186+
let list_is_before_selection = list_loc_in_range.is_some_and(|l| {
187187
l.relative_position() == DomLocationPosition::Before
188188
});
189189
let list_is_last_node_in_selection =

crates/wysiwyg/src/composer_model/new_lines.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ where
223223

224224
let mut children = sub_tree_container.remove_children();
225225
let new_paragraph =
226-
if children.first().map_or(false, |n| n.kind() == Paragraph) {
226+
if children.first().is_some_and(|n| n.kind() == Paragraph) {
227227
children.remove(0)
228228
} else {
229229
DomNode::new_paragraph(children)

crates/wysiwyg/src/dom/iter.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ where
2424
S: UnicodeString,
2525
{
2626
/// Return an iterator over all nodes of this DOM, in depth-first order
27-
pub fn iter(&self) -> DomIterator<S> {
27+
pub fn iter(&self) -> DomIterator<'_, S> {
2828
DomIterator::over(self.document_node())
2929
}
3030

@@ -48,34 +48,37 @@ where
4848

4949
/// Return an iterator over all nodes of the DOM from the passed node,
5050
/// depth-first order (including self).
51-
#[allow(elided_named_lifetimes)]
52-
pub fn iter_from<'a>(&'a self, node: &'a DomNode<S>) -> DomNodeIterator<S> {
51+
pub fn iter_from<'a>(
52+
&'a self,
53+
node: &'a DomNode<S>,
54+
) -> DomNodeIterator<'a, S> {
5355
DomNodeIterator::over(self, node)
5456
}
5557

5658
/// Return an iterator over all nodes of the DOM from the passed DomHandle,
5759
/// depth-first order (including self).
58-
pub fn iter_from_handle(&self, handle: &DomHandle) -> DomNodeIterator<S> {
60+
pub fn iter_from_handle(
61+
&self,
62+
handle: &DomHandle,
63+
) -> DomNodeIterator<'_, S> {
5964
DomNodeIterator::over(self, self.lookup_node(handle))
6065
}
6166

6267
/// Return an iterator over all handles of the DOM from the passed handle,
6368
/// depth-first order (including self).
64-
#[allow(elided_named_lifetimes)]
6569
pub fn handle_iter_from<'a>(
6670
&'a self,
6771
handle: &'a DomHandle,
68-
) -> DomHandleIterator<S> {
72+
) -> DomHandleIterator<'a, S> {
6973
DomHandleIterator::over(self, handle)
7074
}
7175

7276
/// Return an iterator over all text nodes of the DOM from the passed node,
7377
/// depth-first order (including self).
74-
#[allow(elided_named_lifetimes)]
7578
pub fn iter_text_from<'a>(
7679
&'a self,
7780
node: &'a DomNode<S>,
78-
) -> impl Iterator<Item = &TextNode<S>> {
81+
) -> impl Iterator<Item = &'a TextNode<S>> {
7982
self.iter_from(node).filter_map(DomNode::as_text)
8083
}
8184

@@ -135,7 +138,7 @@ where
135138
{
136139
/// Return an iterator over all nodes of the subtree starting from this
137140
/// node (including self), in depth-first order
138-
pub fn iter_subtree(&self) -> DomIterator<S> {
141+
pub fn iter_subtree(&self) -> DomIterator<'_, S> {
139142
DomIterator::over(self)
140143
}
141144

@@ -212,7 +215,6 @@ where
212215
}
213216
}
214217

215-
#[allow(clippy::needless_lifetimes)]
216218
impl<'a, S> DoubleEndedIterator for DomNodeIterator<'a, S>
217219
where
218220
S: UnicodeString,
@@ -300,7 +302,6 @@ where
300302
}
301303
}
302304

303-
#[allow(clippy::needless_lifetimes)]
304305
impl<'a, S> Iterator for DomHandleIterator<'a, S>
305306
where
306307
S: UnicodeString,
@@ -330,7 +331,6 @@ where
330331
}
331332
}
332333

333-
#[allow(clippy::needless_lifetimes)]
334334
impl<'a, S> DoubleEndedIterator for DomHandleIterator<'a, S>
335335
where
336336
S: UnicodeString,

crates/wysiwyg/src/dom/nodes/text_node.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,17 +220,13 @@ where
220220
if !state.is_inside_code_block {
221221
escaped = escaped.replace(" ", "\u{A0}\u{A0}");
222222

223-
if state.next_sibling.is_none()
224-
&& escaped.chars().next_back().map_or(false, |c| c == ' ')
225-
{
223+
if state.next_sibling.is_none() && (escaped.ends_with(' ')) {
226224
// If this is the last node and it ends in a space, replace that
227225
// space with a non-breaking one.
228226
escaped.replace_range(escaped.len() - 1.., "\u{A0}");
229227
}
230228

231-
if state.prev_sibling.is_none()
232-
&& escaped.chars().next().map_or(false, |c| c == ' ')
233-
{
229+
if state.prev_sibling.is_none() && (escaped.starts_with(' ')) {
234230
// If this is the first node and it starts with a space, replace that
235231
// space with a non-breaking one.
236232
escaped.replace_range(..1, "\u{A0}");

crates/wysiwyg/src/dom/parser/parse.rs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -396,22 +396,23 @@ mod sys {
396396
_ => None,
397397
};
398398

399-
if is_mention && text.is_some() {
400-
self.current_path.push(DomNodeKind::Mention);
401-
let mention =
402-
Self::new_mention(child, text.unwrap());
403-
node.append_child(mention);
404-
} else {
405-
self.current_path.push(DomNodeKind::Link);
406-
407-
let link = Self::new_link(child);
408-
node.append_child(link);
409-
self.convert_children(
410-
padom,
411-
child,
412-
last_container_mut_in(&mut node),
413-
html_source,
414-
)?;
399+
match (is_mention, text) {
400+
(true, Some(text)) => {
401+
self.current_path.push(DomNodeKind::Mention);
402+
let mention = Self::new_mention(child, text);
403+
node.append_child(mention);
404+
}
405+
_ => {
406+
self.current_path.push(DomNodeKind::Link);
407+
let link = Self::new_link(child);
408+
node.append_child(link);
409+
self.convert_children(
410+
padom,
411+
child,
412+
last_container_mut_in(&mut node),
413+
html_source,
414+
)?;
415+
}
415416
}
416417
self.current_path.remove(cur_path_idx);
417418
}

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "1.83"
2+
channel = "1.90"
33
components = ["rustfmt"]

0 commit comments

Comments
 (0)