diff --git a/.cargo/config.toml b/.cargo/config.toml index 166d2b893b..c6b2042972 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,8 +1,8 @@ [alias] xtask = "run --package xtask --" -# @fb-only: -# @fb-only: +# @fb-only +# @fb-only [profile.release] lto = "thin" diff --git a/Cargo.toml b/Cargo.toml index 2e10b0ed1e..ae28eee5e3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -99,7 +99,7 @@ threadpool = "1.8.1" timeout-readwrite = "0.3.3" toml = "0.5" tree-sitter = "0.23.2" -# @fb-only: +# @fb-only tree-sitter-erlang = "0.10.0" # @oss-only url = "2.5.4" vfs = { git = "https://github.com/rust-lang/rust-analyzer", rev = "2024-07-29" } diff --git a/crates/base_db/src/lib.rs b/crates/base_db/src/lib.rs index e6bfc592a5..5090c4a20d 100644 --- a/crates/base_db/src/lib.rs +++ b/crates/base_db/src/lib.rs @@ -29,7 +29,7 @@ mod module_index; // Public API pub mod fixture; -// @fb-only: +// @fb-only pub mod test_utils; pub use change::Change; pub use elp_project_model::AppType; @@ -414,7 +414,7 @@ lazy_static! { static ref IGNORED_SOURCES: Vec = { let regexes: Vec> = vec![ //ignore sources goes here - // @fb-only: + // @fb-only ]; regexes.into_iter().flatten().collect::>() }; diff --git a/crates/elp/src/bin/glean.rs b/crates/elp/src/bin/glean.rs index 4b99351a58..b24e83357b 100644 --- a/crates/elp/src/bin/glean.rs +++ b/crates/elp/src/bin/glean.rs @@ -31,7 +31,7 @@ use elp_ide::elp_ide_db::elp_base_db::VfsPath; use elp_ide::elp_ide_db::EqwalizerDatabase; use elp_ide::elp_ide_db::LineIndexDatabase; use elp_ide::elp_ide_db::RootDatabase; -// @fb-only: +// @fb-only use elp_ide::Analysis; use elp_ide::TextRange; use elp_project_model::buck::BuckQueryConfig; @@ -1604,8 +1604,8 @@ impl GleanIndexer { expansion, ods_url: None, }; - // @fb-only: - // @fb-only: + // @fb-only + // @fb-only Some(XRef { source: range.into(), target: XRefTarget::Macro(target.into()), @@ -2459,7 +2459,7 @@ mod tests { %% ^^^^^^^^^^^ macro.erl/macro/COUNT_INFRA/70/has_ods/'atom' "#; - // @fb-only: + // @fb-only } #[test] diff --git a/crates/elp/src/lib.rs b/crates/elp/src/lib.rs index 39cf8053b7..7471c1e676 100644 --- a/crates/elp/src/lib.rs +++ b/crates/elp/src/lib.rs @@ -35,7 +35,7 @@ mod handlers; pub mod line_endings; pub mod lsp_ext; mod mem_docs; -// @fb-only: +// @fb-only mod op_queue; mod project_loader; pub mod reload; @@ -106,7 +106,7 @@ pub fn otp_file_to_ignore(db: &Analysis, file_id: FileId) -> bool { "redbug_dtop", ] .iter() - // @fb-only: + // @fb-only .map(SmolStr::new) .collect(); } diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 04f7ef0050..c2393870a6 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -145,7 +145,7 @@ pub use module_data::TypeAliasDef; pub use module_data::TypeAliasSource; pub use module_data::VarDef; pub use name::known; -// @fb-only: +// @fb-only pub use name::AsName; pub use name::MacroName; pub use name::Name; diff --git a/crates/hir/src/name.rs b/crates/hir/src/name.rs index bf9aaed0de..867ac913fc 100644 --- a/crates/hir/src/name.rs +++ b/crates/hir/src/name.rs @@ -9,7 +9,7 @@ //! See [`Name`]. -// @fb-only: +// @fb-only use std::borrow::Cow; use std::collections::HashSet; diff --git a/crates/ide/src/annotations.rs b/crates/ide/src/annotations.rs index 6b842148e3..dfb6246ea9 100644 --- a/crates/ide/src/annotations.rs +++ b/crates/ide/src/annotations.rs @@ -16,7 +16,7 @@ use elp_syntax::TextRange; use fxhash::FxHashMap; use fxhash::FxHashSet; -// @fb-only: +// @fb-only use crate::runnables::runnables; use crate::runnables::Runnable; @@ -46,7 +46,7 @@ pub struct Link { pub(crate) fn annotations(db: &RootDatabase, file_id: FileId) -> Vec { let mut annotations = Vec::default(); - // @fb-only: + // @fb-only annotations } diff --git a/crates/ide/src/diagnostics.rs b/crates/ide/src/diagnostics.rs index bd142850a1..3471e32147 100644 --- a/crates/ide/src/diagnostics.rs +++ b/crates/ide/src/diagnostics.rs @@ -91,7 +91,7 @@ mod from_config; mod head_mismatch; mod helpers; mod meck; -// @fb-only: +// @fb-only mod missing_compile_warn_missing_spec; mod missing_separator; mod misspelled_attribute; @@ -798,7 +798,7 @@ pub fn native_diagnostics( config .lints_from_config .get_diagnostics(&mut res, &sema, file_id); - // @fb-only: + // @fb-only syntax_diagnostics(&sema, &parse, &mut res, file_id); diagnostics_from_descriptors( &mut res, @@ -1503,7 +1503,7 @@ pub fn ct_diagnostics( let testcases = common_test::runnable_names(&sema, file_id, all.clone(), groups.clone()).ok(); common_test::unreachable_test(&mut res, &sema, file_id, &testcases); - // @fb-only: + // @fb-only } CommonTestInfo::EvalError(_error) => { // The error currently does not contain anything useful, so we ignore it diff --git a/crates/ide/src/diagnostics/application_env.rs b/crates/ide/src/diagnostics/application_env.rs index b0215010cc..477d7a6cd0 100644 --- a/crates/ide/src/diagnostics/application_env.rs +++ b/crates/ide/src/diagnostics/application_env.rs @@ -27,7 +27,7 @@ use crate::codemod_helpers::find_call_in_function; use crate::codemod_helpers::CheckCallCtx; use crate::codemod_helpers::FunctionMatch; use crate::codemod_helpers::MakeDiagCtx; -// @fb-only: +// @fb-only use crate::diagnostics::DiagnosticCode; use crate::diagnostics::Severity; @@ -106,7 +106,7 @@ fn check_function(diags: &mut Vec, sema: &Semantic, def: &FunctionDe vec![2, 3], BadEnvCallAction::AppArg(0), ), - // @fb-only: + // @fb-only ] .into_iter() .flatten() diff --git a/crates/ide/src/diagnostics/atoms_exhaustion.rs b/crates/ide/src/diagnostics/atoms_exhaustion.rs index d605fe393f..4f9b482037 100644 --- a/crates/ide/src/diagnostics/atoms_exhaustion.rs +++ b/crates/ide/src/diagnostics/atoms_exhaustion.rs @@ -18,7 +18,7 @@ use super::DiagnosticDescriptor; use crate::codemod_helpers::find_call_in_function; use crate::codemod_helpers::CheckCallCtx; use crate::codemod_helpers::MakeDiagCtx; -// @fb-only: +// @fb-only use crate::diagnostics::Diagnostic; use crate::diagnostics::DiagnosticCode; use crate::diagnostics::Severity; @@ -47,7 +47,7 @@ fn atoms_exhaustion(diagnostics: &mut Vec, sema: &Semantic, file_id: // FunctionMatch::mfa("erlang", "binary_to_term", 2), ] .into_iter() - // @fb-only: + // @fb-only .collect(); static ref BAD_CALLS_MFAS: Vec<(&'static FunctionMatch, ())> = BAD_CALLS @@ -61,7 +61,7 @@ fn atoms_exhaustion(diagnostics: &mut Vec, sema: &Semantic, file_id: .for_each(|(_arity, def)| { if def.file.file_id == file_id { let is_relevant; - // @fb-only: + // @fb-only is_relevant = true; // @oss-only if is_relevant { check_function(diagnostics, sema, def, &BAD_CALLS_MFAS); @@ -88,7 +88,7 @@ fn check_function( .. }: CheckCallCtx<'_, ()>| { let is_safe; - // @fb-only: + // @fb-only is_safe = false; // @oss-only if !is_safe { match args.as_vec()[..] { diff --git a/crates/ide/src/diagnostics/cross_node_eval.rs b/crates/ide/src/diagnostics/cross_node_eval.rs index 306cf94cbe..ce48c76688 100644 --- a/crates/ide/src/diagnostics/cross_node_eval.rs +++ b/crates/ide/src/diagnostics/cross_node_eval.rs @@ -22,7 +22,7 @@ use super::DiagnosticDescriptor; use crate::codemod_helpers::find_call_in_function; use crate::codemod_helpers::FunctionMatch; use crate::codemod_helpers::MakeDiagCtx; -// @fb-only: +// @fb-only use crate::diagnostics::DiagnosticCode; use crate::diagnostics::Severity; @@ -58,7 +58,7 @@ fn check_function(diags: &mut Vec, sema: &Semantic, def: &FunctionDe FunctionMatch::mfas("erlang", "spawn_monitor", vec![2, 4]).into_iter().map(|fm| (fm,None)).collect(), FunctionMatch::mfas("erlang", "spawn_opt", vec![3, 5]).into_iter().map(|fm| (fm,None)).collect(), FunctionMatch::mfas("sys", "install", vec![2, 3]).into_iter().map(|fm| (fm,None)).collect(), - // @fb-only: + // @fb-only ] .into_iter() .flatten() diff --git a/crates/ide/src/diagnostics/deprecated_function.rs b/crates/ide/src/diagnostics/deprecated_function.rs index 54638efb4a..80fdf77ada 100644 --- a/crates/ide/src/diagnostics/deprecated_function.rs +++ b/crates/ide/src/diagnostics/deprecated_function.rs @@ -40,7 +40,7 @@ use super::DiagnosticDescriptor; use super::Severity; use crate::codemod_helpers::FunctionMatch; use crate::codemod_helpers::FunctionMatcher; -// @fb-only: +// @fb-only use crate::fix; pub(crate) static DESCRIPTOR: DiagnosticDescriptor = DiagnosticDescriptor { @@ -87,7 +87,7 @@ fn deprecated_function(diagnostics: &mut Vec, sema: &Semantic, file_ lazy_static! { static ref DEPRECATED_FUNCTIONS: Vec<(FunctionMatch, DeprecationDetails)> = { let matches: Vec> = vec![ - // @fb-only: + // @fb-only ]; matches.into_iter() .flatten() diff --git a/crates/ide/src/diagnostics/slow_functions.rs b/crates/ide/src/diagnostics/slow_functions.rs index 889c051c2c..1be8d0afa0 100644 --- a/crates/ide/src/diagnostics/slow_functions.rs +++ b/crates/ide/src/diagnostics/slow_functions.rs @@ -73,7 +73,7 @@ See https://www.erlang.org/doc/man/sets.html diagnostic_template: DiagnosticTemplate { code: DiagnosticCode::SlowFunction, message: format!("The dict module is very slow in Erlang.\nIt is recommend to use maps instead of the dict module.\n\n{}\n", - // @fb-only: + // @fb-only "" // @oss-only ) .to_string(), @@ -120,7 +120,7 @@ mod tests { ) } - // @fb-only: + // @fb-only // @oss-only #[allow(dead_code)] fn slow_function_dict() { check_diagnostics( diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs index 0129fcb176..ac657ef9e3 100644 --- a/crates/ide/src/doc_links.rs +++ b/crates/ide/src/doc_links.rs @@ -14,7 +14,7 @@ use elp_syntax::AstNode; use hir::InFile; use hir::Semantic; -// @fb-only: +// @fb-only mod otp_links; #[derive(Debug, Clone, PartialEq, Eq)] @@ -39,7 +39,7 @@ pub(crate) fn external_docs(db: &RootDatabase, position: &FilePosition) -> Optio .iter() .for_each(|def| otp_links::links(&mut doc_links, &sema, &def)); } - // @fb-only: + // @fb-only Some(doc_links) } diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs index d633a9edc2..5292d830b4 100644 --- a/crates/ide/src/lib.rs +++ b/crates/ide/src/lib.rs @@ -107,7 +107,7 @@ pub mod diagnostics; pub mod diagnostics_collection; pub mod diff; mod highlight_related; -// @fb-only: +// @fb-only pub use annotations::Annotation; pub use annotations::AnnotationKind; diff --git a/crates/ide_completion/src/lib.rs b/crates/ide_completion/src/lib.rs index 4ecc6df644..9ef4e8c3b5 100644 --- a/crates/ide_completion/src/lib.rs +++ b/crates/ide_completion/src/lib.rs @@ -34,7 +34,7 @@ mod helpers; mod keywords; mod macros; mod maps; -// @fb-only: +// @fb-only mod modules; mod records; mod spec; @@ -164,7 +164,7 @@ pub fn completions( } CtxKind::Other => { let _ = attributes::add_completions(&mut acc, ctx) - // @fb-only: + // @fb-only || vars::add_completions(&mut acc, ctx) || maps::add_completions(&mut acc, ctx) || records::add_completions(&mut acc, ctx); diff --git a/crates/ide_db/src/diagnostic_code.rs b/crates/ide_db/src/diagnostic_code.rs index 92932337e5..1af6a22bed 100644 --- a/crates/ide_db/src/diagnostic_code.rs +++ b/crates/ide_db/src/diagnostic_code.rs @@ -19,9 +19,9 @@ use serde::Deserializer; use strum::IntoEnumIterator; use strum_macros::EnumIter; -// @fb-only: +// @fb-only -// @fb-only: +// @fb-only pub const BASE_URL: &str = "https://whatsapp.github.io/erlang-language-platform/docs"; // @oss-only #[derive(Clone, Debug, PartialEq, Eq, Hash, EnumIter)] @@ -65,7 +65,7 @@ pub enum DiagnosticCode { Eqwalizer(String), // Used for ad-hoc diagnostics via lints/codemods AdHoc(String), - // @fb-only: + // @fb-only } // These namespaces map the error codes returned by the Erlang Service. @@ -186,7 +186,7 @@ impl DiagnosticCode { DiagnosticCode::ErlangService(c) => c.to_string(), DiagnosticCode::Eqwalizer(c) => format!("eqwalizer: {c}"), DiagnosticCode::AdHoc(c) => format!("ad-hoc: {c}"), - // @fb-only: + // @fb-only } } @@ -232,7 +232,7 @@ impl DiagnosticCode { DiagnosticCode::ErlangService(c) => c.to_string(), DiagnosticCode::Eqwalizer(c) => c.to_string(), DiagnosticCode::AdHoc(c) => format!("ad-hoc: {c}"), - // @fb-only: + // @fb-only } } @@ -243,7 +243,7 @@ impl DiagnosticCode { pub fn maybe_from_string(s: &str) -> Option { DIAGNOSTIC_CODE_LOOKUPS .get(s).cloned() - // @fb-only: + // @fb-only .or_else( || // Look for ErlangService and AdHoc if let Some(code) = Self::is_adhoc(s) { @@ -260,7 +260,7 @@ impl DiagnosticCode { match self { DiagnosticCode::DefaultCodeForEnumIter => None, DiagnosticCode::AdHoc(_) => None, - // @fb-only: + // @fb-only DiagnosticCode::ErlangService(code) => Namespace::from_str(code).ok(), _ => Namespace::from_str(&self.as_code()).ok(), } @@ -351,7 +351,7 @@ impl DiagnosticCode { DiagnosticCode::ErlangService(_) => false, DiagnosticCode::Eqwalizer(_) => false, DiagnosticCode::AdHoc(_) => false, - // @fb-only: + // @fb-only } } } diff --git a/crates/ide_db/src/lib.rs b/crates/ide_db/src/lib.rs index e1b8b3b8aa..674cd2980c 100644 --- a/crates/ide_db/src/lib.rs +++ b/crates/ide_db/src/lib.rs @@ -56,7 +56,7 @@ pub mod docs; pub mod eqwalizer; mod erl_ast; mod line_index; -// @fb-only: +// @fb-only pub mod metadata; mod search; diff --git a/crates/project_model/src/buck.rs b/crates/project_model/src/buck.rs index 2d199bfaf6..ea38ed1292 100644 --- a/crates/project_model/src/buck.rs +++ b/crates/project_model/src/buck.rs @@ -1456,7 +1456,7 @@ mod tests { } // TODO: enable when buck is properly set up on github project - // @fb-only: + // @fb-only const BUCK_TESTS_ENABLED: bool = false; // @oss-only fn get_prelude_cell(buck_config: &BuckConfig) -> Result { diff --git a/erlang_service/src/elp_lint.erl b/erlang_service/src/elp_lint.erl index 2d832ba39c..f987723387 100644 --- a/erlang_service/src/elp_lint.erl +++ b/erlang_service/src/elp_lint.erl @@ -4306,14 +4306,14 @@ is_format_function(io, fwrite) -> true; is_format_function(io, format) -> true; is_format_function(io_lib, fwrite) -> true; is_format_function(io_lib, format) -> true; -% @fb-only: -% @fb-only: +% @fb-only +% @fb-only is_format_function(M, F) when is_atom(M), is_atom(F) -> false. %% check_format_1([Arg]) -> ok | {warn,Level,Format,[Arg]}. -% @fb-only: -% @fb-only: +% @fb-only +% @fb-only format_args(_M, _F, As) -> As.