{"record":{"id":"c9d8a9259fe96202","repo":"oxc-project/oxc","slug":"the-function-is-equivalent-to-called-fn-call","errorCode":null,"errorMessage":"The function is equivalent to `{called_fn}`. Call `{called_fn}` directly.","messagePattern":"The function is equivalent to `(.+?)`\\. Call `(.+?)` directly\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/unicorn/prefer_native_coercion_functions.rs","lineNumber":13,"sourceCode":"use oxc_ast::{\n    AstKind,\n    ast::{Argument, Expression, FormalParameters, FunctionBody, Statement, TSType},\n};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_semantic::NodeId;\nuse oxc_span::{GetSpan, Span};\n\nuse crate::{AstNode, context::LintContext, rule::Rule, utils::get_first_parameter_name};\n\nfn function(span: Span, called_fn: &str) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\n        \"The function is equivalent to `{called_fn}`. Call `{called_fn}` directly.\"\n    ))\n    .with_label(span)\n}\n\nfn array_callback(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"The arrow function in the callback of the array is equivalent to `Boolean`. Replace the callback with `Boolean`.\")\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct PreferNativeCoercionFunctions;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// Prefers built-in functions over custom ones with the same functionality.\n    ///","sourceCodeStart":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/unicorn/prefer_native_coercion_functions.rs#L1-L31","documentation":"Diagnostic from the unicorn/prefer-native-coercion-functions lint rule. It fires when a function (declared or arrow) does nothing but coerce its first parameter and return it, e.g. `function toStr(v) { return String(v); }`; the wrapper is redundant and the native function named in the message (`String`, `Number`, `Boolean`) can be passed directly. The flagged input is the redundant function's span. It is a lint suggestion, not a runtime error.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/unicorn/prefer_native_coercion_functions.rs:13 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Replace the wrapper with the native function itself, e.g. `arr.map(String)` instead of `arr.map(v => String(v))`","Delete the now-unused wrapper declaration","Apply the rule's auto-fix"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}