From d5627c5f8f65c53551b338027fa1f0ba671ae64f Mon Sep 17 00:00:00 2001 From: Roberto Aloi Date: Fri, 3 May 2024 02:55:11 -0700 Subject: [PATCH] Do not warn about usages of binary_to_term Summary: Detection of unsafe usages for `binary_to_term` is opinionated. Temporarily disable it, while working on making it configurable. Differential Revision: D56922819 fbshipit-source-id: 2f3838d475bcb5416bf4d5895bbd578693633e70 --- crates/ide/src/diagnostics/atoms_exhaustion.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/crates/ide/src/diagnostics/atoms_exhaustion.rs b/crates/ide/src/diagnostics/atoms_exhaustion.rs index 50ff234ed3..96d2a5b943 100644 --- a/crates/ide/src/diagnostics/atoms_exhaustion.rs +++ b/crates/ide/src/diagnostics/atoms_exhaustion.rs @@ -41,8 +41,9 @@ fn atoms_exhaustion(diagnostics: &mut Vec, sema: &Semantic, file_id: FunctionMatch::mfa("erlang", "binary_to_atom", 1), FunctionMatch::mfa("erlang", "binary_to_atom", 2), FunctionMatch::mfa("erlang", "list_to_atom", 1), - FunctionMatch::mfa("erlang", "binary_to_term", 1), - FunctionMatch::mfa("erlang", "binary_to_term", 2), + // T187850479: Make it configurable + // FunctionMatch::mfa("erlang", "binary_to_term", 1), + // FunctionMatch::mfa("erlang", "binary_to_term", 2), ] .into_iter() // @fb-only: .chain(diagnostics::meta_only::atoms_exhaustion_matches().into_iter()) @@ -175,10 +176,8 @@ mod tests { main() -> Foo = term_to_binary(foo), binary_to_term(Foo), -%% ^^^^^^^^^^^^^^^^^^^ 💡 error: Risk of atoms exhaustion. Bar = term_to_binary(bar), erlang:binary_to_term(Bar). -%% ^^^^^^^^^^^^^^^^^^^^^^^^^^ 💡 error: Risk of atoms exhaustion. //- /opt/lib/stdlib-3.17/src/erlang.erl otp_app:/opt/lib/stdlib-3.17 -module(erlang). @@ -222,10 +221,8 @@ mod tests { main() -> Foo = term_to_binary(foo), binary_to_term(Foo, []), -%% ^^^^^^^^^^^^^^^^^^^^^^^ 💡 error: Risk of atoms exhaustion. Bar = term_to_binary(bar), erlang:binary_to_term(Bar, []). -%% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 💡 error: Risk of atoms exhaustion. //- /opt/lib/stdlib-3.17/src/erlang.erl otp_app:/opt/lib/stdlib-3.17 -module(erlang).