miniextendr_lint/rules/
rf_error.rs1use crate::crate_index::CrateIndex;
9use crate::diagnostic::Diagnostic;
10use crate::lint_code::LintCode;
11
12pub fn check(index: &CrateIndex, diagnostics: &mut Vec<Diagnostic>) {
13 for (path, data) in &index.file_data {
14 for (fn_name, line) in &data.rf_error_calls {
15 diagnostics.push(
16 Diagnostic::new(
17 LintCode::MXL300,
18 path,
19 *line,
20 format!(
21 "Direct `{}()` call. This longjmps through Rust frames \
22 and may skip destructors.",
23 fn_name,
24 ),
25 )
26 .with_help(
27 "Use `panic!()` for unrecoverable errors or return `Err(...)` for \
28 Result types. These produce structured R condition objects via \
29 the tagged-condition transport.",
30 ),
31 );
32 }
33 }
34}