Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-diagnostics/src/handlers/incorrect_try_expr.rs')
| -rw-r--r-- | crates/ide-diagnostics/src/handlers/incorrect_try_expr.rs | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/crates/ide-diagnostics/src/handlers/incorrect_try_expr.rs b/crates/ide-diagnostics/src/handlers/incorrect_try_expr.rs deleted file mode 100644 index 085d8d3259..0000000000 --- a/crates/ide-diagnostics/src/handlers/incorrect_try_expr.rs +++ /dev/null @@ -1,37 +0,0 @@ -use hir::InFile; - -use crate::{Diagnostic, DiagnosticsContext}; - -// Diagnostic: incorrect-try-target -// -// This diagnostic is triggered if a question mark operator was used in a context where it is not applicable. -pub(crate) fn incorrect_try_expr( - ctx: &DiagnosticsContext<'_>, - d: &hir::IncorrectTryExpr, -) -> Diagnostic { - Diagnostic::new( - "incorrect-try-target", - format!("the return type of the containing function does not implement `FromResidual`"), - ctx.sema - .diagnostics_display_range(InFile::new(d.expr.file_id, d.expr.value.clone().into())) - .range, - ) -} - -#[cfg(test)] -mod tests { - use crate::tests::check_diagnostics; - - #[test] - fn try_ops_diag() { - check_diagnostics( - r#" -//- minicore: try -fn test() { - core::ops::ControlFlow::<u32, f32>::Continue(1.0)?; - // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the return type of the containing function does not implement `FromResidual` -} -"#, - ); - } -} |