@@ -3348,26 +3348,24 @@ fn goto_first_diag(cx: &mut Context) {
3348 let editor = &mut cx.editor;
3348 let editor = &mut cx.editor;
3349 let (_, doc) = current!(editor);
3349 let (_, doc) = current!(editor);
3351− let diag = if let Some(diag) = doc.diagnostics().first() {
3351+ let pos = match doc.diagnostics().first() {
3352− diag.range.start
3352+ Some(diag) => diag.range.start,
3354− return;
3353+ None => return,
3357− goto_pos(editor, diag);
3356+ goto_pos(editor, pos);
3360fn goto_last_diag(cx: &mut Context) {
3359fn goto_last_diag(cx: &mut Context) {
3361 let editor = &mut cx.editor;
3360 let editor = &mut cx.editor;
3362 let (_, doc) = current!(editor);
3361 let (_, doc) = current!(editor);
3364− let diag = if let Some(diag) = doc.diagnostics().last() {
3363+ let pos = match doc.diagnostics().last() {
3365− diag.range.start
3364+ Some(diag) => diag.range.start,
3367− return;
3365+ None => return,
3370− goto_pos(editor, diag);
3368+ goto_pos(editor, pos);
3373fn goto_next_diag(cx: &mut Context) {
3371fn goto_next_diag(cx: &mut Context) {
@@ -3378,20 +3376,19 @@ fn goto_next_diag(cx: &mut Context) {
3378 .selection(view.id)
3376 .selection(view.id)
3379 .primary()
3377 .primary()
3380 .cursor(doc.text().slice(..));
3378 .cursor(doc.text().slice(..));
3381− let diag = if let Some(diag) = doc
3380+ let diag = doc
3382 .diagnostics()
3381 .diagnostics()
3384− .map(|diag| diag.range.start)
3385− .find(|&pos| pos > cursor_pos)
3383+ .find(|diag| diag.range.start > cursor_pos)
3388− } else if let Some(diag) = doc.diagnostics().first() {
3384+ .or_else(|| doc.diagnostics().first());
3386+ let pos = match diag {
3389− diag.range.start
3387+ Some(diag) => diag.range.start,
3391− return;
3388+ None => return,
3394− goto_pos(editor, diag);
3391+ goto_pos(editor, pos);
3397fn goto_prev_diag(cx: &mut Context) {
3394fn goto_prev_diag(cx: &mut Context) {
@@ -3402,21 +3399,20 @@ fn goto_prev_diag(cx: &mut Context) {
3402 .selection(view.id)
3399 .selection(view.id)
3403 .primary()
3400 .primary()
3404 .cursor(doc.text().slice(..));
3401 .cursor(doc.text().slice(..));
3405− let diag = if let Some(diag) = doc
3403+ let diag = doc
3406 .diagnostics()
3404 .diagnostics()
3409− .map(|diag| diag.range.start)
3410− .find(|&pos| pos < cursor_pos)
3407+ .find(|diag| diag.range.start < cursor_pos)
3413− } else if let Some(diag) = doc.diagnostics().last() {
3408+ .or_else(|| doc.diagnostics().last());
3410+ let pos = match diag {
3414− diag.range.start
3411+ Some(diag) => diag.range.start,
3416− return;
3412+ None => return,
3419− goto_pos(editor, diag);
3415+ goto_pos(editor, pos);
3422fn signature_help(cx: &mut Context) {
3418fn signature_help(cx: &mut Context) {