chore: Prepare for Rust edition bump to 2024 (without autofix) (#27791)
Successor to #27779 - in this PR I've applied changes manually, without futzing with if let lifetimes at all. Release Notes: - N/A
This commit is contained in:
parent
d51aa2ffb0
commit
0729d24d77
162 changed files with 2333 additions and 1937 deletions
|
@ -49,7 +49,7 @@ impl<'a> CommitAvatar<'a> {
|
|||
&'a self,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<CommitTooltip>,
|
||||
) -> Option<impl IntoElement> {
|
||||
) -> Option<impl IntoElement + use<>> {
|
||||
let remote = self
|
||||
.commit
|
||||
.message
|
||||
|
|
|
@ -1464,7 +1464,7 @@ pub mod tests {
|
|||
});
|
||||
|
||||
let buffer = cx.update(|cx| {
|
||||
if rng.gen() {
|
||||
if rng.r#gen() {
|
||||
let len = rng.gen_range(0..10);
|
||||
let text = util::RandomCharIter::new(&mut rng)
|
||||
.take(len)
|
||||
|
@ -1526,7 +1526,7 @@ pub mod tests {
|
|||
}
|
||||
30..=44 => {
|
||||
map.update(cx, |map, cx| {
|
||||
if rng.gen() || blocks.is_empty() {
|
||||
if rng.r#gen() || blocks.is_empty() {
|
||||
let buffer = map.snapshot(cx).buffer_snapshot;
|
||||
let block_properties = (0..rng.gen_range(1..=1))
|
||||
.map(|_| {
|
||||
|
@ -1536,7 +1536,7 @@ pub mod tests {
|
|||
Bias::Left,
|
||||
));
|
||||
|
||||
let placement = if rng.gen() {
|
||||
let placement = if rng.r#gen() {
|
||||
BlockPlacement::Above(position)
|
||||
} else {
|
||||
BlockPlacement::Below(position)
|
||||
|
@ -1580,7 +1580,7 @@ pub mod tests {
|
|||
});
|
||||
}
|
||||
|
||||
if rng.gen() && fold_count > 0 {
|
||||
if rng.r#gen() && fold_count > 0 {
|
||||
log::info!("unfolding ranges: {:?}", ranges);
|
||||
map.update(cx, |map, cx| {
|
||||
map.unfold_intersecting(ranges, true, cx);
|
||||
|
|
|
@ -1370,7 +1370,7 @@ impl BlockSnapshot {
|
|||
while let Some(transform) = cursor.item() {
|
||||
match &transform.block {
|
||||
Some(Block::ExcerptBoundary { excerpt, .. }) => {
|
||||
return Some(StickyHeaderExcerpt { excerpt })
|
||||
return Some(StickyHeaderExcerpt { excerpt });
|
||||
}
|
||||
Some(block) if block.is_buffer_header() => return None,
|
||||
_ => {
|
||||
|
@ -2913,7 +2913,7 @@ mod tests {
|
|||
|
||||
log::info!("Wrap width: {:?}", wrap_width);
|
||||
log::info!("Excerpt Header Height: {:?}", excerpt_header_height);
|
||||
let is_singleton = rng.gen();
|
||||
let is_singleton = rng.r#gen();
|
||||
let buffer = if is_singleton {
|
||||
let len = rng.gen_range(0..10);
|
||||
let text = RandomCharIter::new(&mut rng).take(len).collect::<String>();
|
||||
|
@ -3077,7 +3077,9 @@ mod tests {
|
|||
let fold = !unfolded_buffers.is_empty() && rng.gen_bool(0.5);
|
||||
let unfold = !folded_buffers.is_empty() && rng.gen_bool(0.5);
|
||||
if !fold && !unfold {
|
||||
log::info!("Noop fold/unfold operation. Unfolded buffers: {unfolded_count}, folded buffers: {folded_count}");
|
||||
log::info!(
|
||||
"Noop fold/unfold operation. Unfolded buffers: {unfolded_count}, folded buffers: {folded_count}"
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -1616,7 +1616,7 @@ mod tests {
|
|||
|
||||
let len = rng.gen_range(0..10);
|
||||
let text = RandomCharIter::new(&mut rng).take(len).collect::<String>();
|
||||
let buffer = if rng.gen() {
|
||||
let buffer = if rng.r#gen() {
|
||||
MultiBuffer::build_simple(&text, cx)
|
||||
} else {
|
||||
MultiBuffer::build_random(&mut rng, cx)
|
||||
|
@ -1962,7 +1962,7 @@ mod tests {
|
|||
let start = buffer.clip_offset(rng.gen_range(0..=end), Left);
|
||||
to_unfold.push(start..end);
|
||||
}
|
||||
let inclusive = rng.gen();
|
||||
let inclusive = rng.r#gen();
|
||||
log::info!("unfolding {:?} (inclusive: {})", to_unfold, inclusive);
|
||||
let (mut writer, snapshot, edits) = self.write(inlay_snapshot, vec![]);
|
||||
snapshot_edits.push((snapshot, edits));
|
||||
|
|
|
@ -610,9 +610,9 @@ impl InlayMap {
|
|||
let mut to_insert = Vec::new();
|
||||
let snapshot = &mut self.snapshot;
|
||||
for i in 0..rng.gen_range(1..=5) {
|
||||
if self.inlays.is_empty() || rng.gen() {
|
||||
if self.inlays.is_empty() || rng.r#gen() {
|
||||
let position = snapshot.buffer.random_byte_range(0, rng).start;
|
||||
let bias = if rng.gen() { Bias::Left } else { Bias::Right };
|
||||
let bias = if rng.r#gen() { Bias::Left } else { Bias::Right };
|
||||
let len = if rng.gen_bool(0.01) {
|
||||
0
|
||||
} else {
|
||||
|
@ -1500,7 +1500,7 @@ mod tests {
|
|||
.unwrap_or(10);
|
||||
|
||||
let len = rng.gen_range(0..30);
|
||||
let buffer = if rng.gen() {
|
||||
let buffer = if rng.r#gen() {
|
||||
let text = util::RandomCharIter::new(&mut rng)
|
||||
.take(len)
|
||||
.collect::<String>();
|
||||
|
|
|
@ -738,7 +738,7 @@ mod tests {
|
|||
fn test_random_tabs(cx: &mut gpui::App, mut rng: StdRng) {
|
||||
let tab_size = NonZeroU32::new(rng.gen_range(1..=4)).unwrap();
|
||||
let len = rng.gen_range(0..30);
|
||||
let buffer = if rng.gen() {
|
||||
let buffer = if rng.r#gen() {
|
||||
let text = util::RandomCharIter::new(&mut rng)
|
||||
.take(len)
|
||||
.collect::<String>();
|
||||
|
|
|
@ -1207,7 +1207,7 @@ mod tests {
|
|||
log::info!("Wrap width: {:?}", wrap_width);
|
||||
|
||||
let buffer = cx.update(|cx| {
|
||||
if rng.gen() {
|
||||
if rng.r#gen() {
|
||||
MultiBuffer::build_random(&mut rng, cx)
|
||||
} else {
|
||||
let len = rng.gen_range(0..10);
|
||||
|
|
|
@ -2428,7 +2428,11 @@ impl Editor {
|
|||
background_executor.timer(SERIALIZATION_THROTTLE_TIME).await;
|
||||
DB.save_editor_folds(editor_id, workspace_id, db_folds)
|
||||
.await
|
||||
.with_context(|| format!("persisting editor folds for editor {editor_id}, workspace {workspace_id:?}"))
|
||||
.with_context(|| {
|
||||
format!(
|
||||
"persisting editor folds for editor {editor_id}, workspace {workspace_id:?}"
|
||||
)
|
||||
})
|
||||
.log_err();
|
||||
});
|
||||
}
|
||||
|
@ -6200,7 +6204,9 @@ impl Editor {
|
|||
fn insert_tasks(&mut self, key: (BufferId, BufferRow), value: RunnableTasks) {
|
||||
if self.tasks.insert(key, value).is_some() {
|
||||
// This case should hopefully be rare, but just in case...
|
||||
log::error!("multiple different run targets found on a single line, only the last target will be rendered")
|
||||
log::error!(
|
||||
"multiple different run targets found on a single line, only the last target will be rendered"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7985,7 +7985,9 @@ async fn test_multibuffer_format_during_save(cx: &mut TestAppContext) {
|
|||
assert!(cx.read(|cx| !multi_buffer_editor.is_dirty(cx)));
|
||||
assert_eq!(
|
||||
multi_buffer_editor.update(cx, |editor, cx| editor.text(cx)),
|
||||
uri!("a|o[file:///a/main.rs formatted]bbbb\ncccc\n\nffff\ngggg\n\njjjj\n\nlll[file:///a/other.rs formatted]mmmm\nnnnn|four|five|six|\nr\n\nuuuu\n\nvvvv\nwwww\nxxxx\n\n{{{{\n||||\n\n\u{7f}\u{7f}\u{7f}\u{7f}"),
|
||||
uri!(
|
||||
"a|o[file:///a/main.rs formatted]bbbb\ncccc\n\nffff\ngggg\n\njjjj\n\nlll[file:///a/other.rs formatted]mmmm\nnnnn|four|five|six|\nr\n\nuuuu\n\nvvvv\nwwww\nxxxx\n\n{{{{\n||||\n\n\u{7f}\u{7f}\u{7f}\u{7f}"
|
||||
),
|
||||
);
|
||||
buffer_1.update(cx, |buffer, _| {
|
||||
assert!(!buffer.is_dirty());
|
||||
|
@ -18669,7 +18671,7 @@ fn assert_selection_ranges(marked_text: &str, editor: &mut Editor, cx: &mut Cont
|
|||
pub fn handle_signature_help_request(
|
||||
cx: &mut EditorLspTestContext,
|
||||
mocked_response: lsp::SignatureHelp,
|
||||
) -> impl Future<Output = ()> {
|
||||
) -> impl Future<Output = ()> + use<> {
|
||||
let mut request =
|
||||
cx.set_request_handler::<lsp::request::SignatureHelpRequest, _, _>(move |_, _, _| {
|
||||
let mocked_response = mocked_response.clone();
|
||||
|
|
|
@ -4190,8 +4190,7 @@ impl EditorElement {
|
|||
None;
|
||||
for (&new_row, &new_background) in &layout.highlighted_rows {
|
||||
match &mut current_paint {
|
||||
Some((current_background, current_range, mut edges)) => {
|
||||
let current_background = *current_background;
|
||||
&mut Some((current_background, ref mut current_range, mut edges)) => {
|
||||
let new_range_started = current_background != new_background
|
||||
|| current_range.end.next_row() != new_row;
|
||||
if new_range_started {
|
||||
|
@ -8793,8 +8792,10 @@ mod tests {
|
|||
px(500.0),
|
||||
show_line_numbers,
|
||||
);
|
||||
assert!(invisibles.is_empty(),
|
||||
"For editor mode {editor_mode_without_invisibles:?} no invisibles was expected but got {invisibles:?}");
|
||||
assert!(
|
||||
invisibles.is_empty(),
|
||||
"For editor mode {editor_mode_without_invisibles:?} no invisibles was expected but got {invisibles:?}"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8872,7 +8873,9 @@ mod tests {
|
|||
(Invisible::Whitespace { .. }, Invisible::Whitespace { .. })
|
||||
| (Invisible::Tab { .. }, Invisible::Tab { .. }) => {}
|
||||
_ => {
|
||||
panic!("At index {i}, expected invisible {expected_invisible:?} does not match actual {actual_invisible:?} by kind. Actual invisibles: {actual_invisibles:?}")
|
||||
panic!(
|
||||
"At index {i}, expected invisible {expected_invisible:?} does not match actual {actual_invisible:?} by kind. Actual invisibles: {actual_invisibles:?}"
|
||||
)
|
||||
}
|
||||
},
|
||||
None => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue