Skip to content

Commit

Permalink
fix: remove usages of gen reserved keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
siketyan committed Mar 1, 2025
1 parent 2a0b197 commit 0de2546
Show file tree
Hide file tree
Showing 23 changed files with 52 additions and 52 deletions.
4 changes: 2 additions & 2 deletions crates/biome_analyze/src/categories.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@ impl schemars::JsonSchema for RuleCategories {
String::from("RuleCategories")
}

fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
<Vec<RuleCategory>>::json_schema(gen)
fn json_schema(generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
<Vec<RuleCategory>>::json_schema(generator)
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/biome_configuration/src/analyzer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,8 @@ impl schemars::JsonSchema for RuleSelector {
fn schema_name() -> String {
"RuleCode".to_string()
}
fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
String::json_schema(gen)
fn json_schema(generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
String::json_schema(generator)
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/biome_configuration/src/bool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ impl<const D: bool> schemars::JsonSchema for Bool<D> {
"Bool".to_string()
}

fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
bool::json_schema(gen)
fn json_schema(generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
bool::json_schema(generator)
}
}
4 changes: 2 additions & 2 deletions crates/biome_configuration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,8 @@ impl schemars::JsonSchema for Schema {
"Schema".into()
}

fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
String::json_schema(gen)
fn json_schema(generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
String::json_schema(generator)
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/biome_configuration/src/overrides.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ impl schemars::JsonSchema for OverrideGlobs {
fn schema_name() -> String {
"OverrideGlobs".to_string()
}
fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
Vec::<biome_glob::Glob>::json_schema(gen)
fn json_schema(generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
Vec::<biome_glob::Glob>::json_schema(generator)
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/biome_diagnostics/src/display/backtrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ impl schemars::JsonSchema for Backtrace {
String::from("Backtrace")
}

fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
<Vec<SerializedFrame>>::json_schema(gen)
fn json_schema(generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
<Vec<SerializedFrame>>::json_schema(generator)
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/biome_diagnostics/src/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,8 @@ impl schemars::JsonSchema for DiagnosticTags {
String::from("DiagnosticTags")
}

fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
<Vec<DiagnosticTag>>::json_schema(gen)
fn json_schema(generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
<Vec<DiagnosticTag>>::json_schema(generator)
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/biome_diagnostics_categories/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub fn main() -> io::Result<()> {
String::from("Category")
}

fn json_schema(_gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
fn json_schema(_gen: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
schemars::schema::Schema::Object(schemars::schema::SchemaObject {
instance_type: Some(schemars::schema::InstanceType::String.into()),
enum_values: Some(vec![#( #enum_variants.into() ),*]),
Expand Down
8 changes: 4 additions & 4 deletions crates/biome_fs/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ impl schemars::JsonSchema for BiomePath {
"BiomePath".to_string()
}

fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
String::json_schema(gen)
fn json_schema(generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
String::json_schema(generator)
}
}

Expand Down Expand Up @@ -260,8 +260,8 @@ impl schemars::JsonSchema for FileKinds {
String::from("FileKind")
}

fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
<Vec<FileKind>>::json_schema(gen)
fn json_schema(generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
<Vec<FileKind>>::json_schema(generator)
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/biome_glob/src/editorconfig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ impl schemars::JsonSchema for EditorconfigGlob {
"Glob".to_string()
}

fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
String::json_schema(gen)
fn json_schema(generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
String::json_schema(generator)
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/biome_glob/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,8 @@ impl schemars::JsonSchema for Glob {
"Glob".to_string()
}

fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
String::json_schema(gen)
fn json_schema(generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
String::json_schema(generator)
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/biome_grit_patterns/src/grit_built_in_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ fn length_fn<'a>(
None => {
return Err(GritPatternError::new(
"length() requires a list or string as the first argument",
))
));
}
}
}
Expand Down Expand Up @@ -443,7 +443,7 @@ fn random_fn<'a>(
Ok(ResolvedPattern::from_constant(Constant::Integer(value)))
}
[None, None] => {
let value = state.get_rng().gen::<f64>();
let value = state.get_rng().r#gen::<f64>();
Ok(ResolvedPattern::from_constant(Constant::Float(value)))
}
_ => Err(GritPatternError::new(
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_grit_patterns/src/grit_target_language.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ macro_rules! generate_target_language {
"GritTargetLanguage".to_owned()
}

fn json_schema(_gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
fn json_schema(_generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
schemars::schema::Schema::Object(schemars::schema::SchemaObject {
enum_values: Some(vec![
$(serde_json::json!($name)),+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl schemars::JsonSchema for DependencyAvailability {
"DependencyAvailability".to_owned()
}

fn json_schema(_gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
fn json_schema(_generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
use schemars::schema::*;

Schema::Object(SchemaObject {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,8 @@ impl schemars::JsonSchema for FilenameCases {
fn schema_name() -> String {
"FilenameCases".to_string()
}
fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
<std::collections::HashSet<FilenameCase>>::json_schema(gen)
fn json_schema(generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
<std::collections::HashSet<FilenameCase>>::json_schema(generator)
}
}
impl Default for FilenameCases {
Expand Down
14 changes: 7 additions & 7 deletions crates/biome_js_analyze/src/lint/style/use_naming_convention.rs
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ impl Rule for UseNamingConvention {
"This "<Emphasis>{format_args!("{convention_selector}")}</Emphasis>" name"{trimmed_info}" should be in "<Emphasis>{expected_case_names}</Emphasis>"."
},
))
},
}
}
}

Expand Down Expand Up @@ -919,7 +919,7 @@ impl Rule for UseNamingConvention {
return Some(JsRuleAction::new(
ctx.metadata().action_category(ctx.category(), ctx.group()),
ctx.metadata().applicability(),
markup! { "Rename this symbol in "<Emphasis>{preferred_case.to_string()}</Emphasis>"." }.to_owned(),
markup! { "Rename this symbol in "<Emphasis>{preferred_case.to_string()}</Emphasis>"." }.to_owned(),
mutation,
));
}
Expand Down Expand Up @@ -1374,7 +1374,7 @@ impl Selector {
} else {
Some(Kind::IndexParameter.into())
}
},
}
AnyJsBindingDeclaration::JsNamespaceImportSpecifier(_) => Some(Selector::with_scope(Kind::ImportNamespace, Scope::Global)),
AnyJsBindingDeclaration::JsFunctionDeclaration(_)
| AnyJsBindingDeclaration::JsFunctionExpression(_)
Expand Down Expand Up @@ -1854,8 +1854,8 @@ impl JsonSchema for Modifiers {
"Modifiers".to_string()
}

fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
<std::collections::HashSet<RestrictedModifier>>::json_schema(gen)
fn json_schema(generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
<std::collections::HashSet<RestrictedModifier>>::json_schema(generator)
}
}
impl From<JsMethodModifierList> for Modifiers {
Expand Down Expand Up @@ -2049,8 +2049,8 @@ impl JsonSchema for Formats {
fn schema_name() -> String {
"Formats".to_string()
}
fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
<std::collections::HashSet<Format>>::json_schema(gen)
fn json_schema(generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
<std::collections::HashSet<Format>>::json_schema(generator)
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/biome_js_analyze/src/react/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ impl JsonSchema for StableHookResult {
"StableHookResult".to_owned()
}

fn json_schema(_gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
fn json_schema(_generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
use schemars::schema::*;
Schema::Object(SchemaObject {
subschemas: Some(Box::new(SubschemaValidation {
Expand Down
4 changes: 2 additions & 2 deletions crates/biome_js_analyze/src/utils/restricted_regex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ impl schemars::JsonSchema for RestrictedRegex {
"Regex".to_string()
}

fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
String::json_schema(gen)
fn json_schema(generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
String::json_schema(generator)
}
}

Expand Down
6 changes: 3 additions & 3 deletions crates/biome_service/src/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ use camino::Utf8Path;
use core::str;
use enumflags2::{bitflags, BitFlags};
#[cfg(feature = "schema")]
use schemars::{gen::SchemaGenerator, schema::Schema};
use schemars::{r#gen::SchemaGenerator, schema::Schema};
use smallvec::SmallVec;
use std::collections::HashMap;
use std::time::Duration;
Expand Down Expand Up @@ -492,8 +492,8 @@ impl schemars::JsonSchema for FeatureName {
String::from("FeatureName")
}

fn json_schema(gen: &mut SchemaGenerator) -> Schema {
<Vec<FeatureKind>>::json_schema(gen)
fn json_schema(generator: &mut SchemaGenerator) -> Schema {
<Vec<FeatureKind>>::json_schema(generator)
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/biome_service/src/workspace_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::collections::VecDeque;
use biome_js_syntax::{AnyJsDeclaration, AnyTsTupleTypeElement};
use rustc_hash::FxHashSet;
use schemars::{
gen::{SchemaGenerator, SchemaSettings},
r#gen::{SchemaGenerator, SchemaSettings},
schema::{InstanceType, RootSchema, Schema, SchemaObject, SingleOrVec},
JsonSchema,
};
Expand Down Expand Up @@ -308,7 +308,7 @@ pub fn generate_type<'a>(
match root_name {
"Null" => return AnyTsType::TsVoidType(make::ts_void_type(make::token(T![void]))),
"Boolean" => {
return AnyTsType::TsBooleanType(make::ts_boolean_type(make::token(T![boolean])))
return AnyTsType::TsBooleanType(make::ts_boolean_type(make::token(T![boolean])));
}
"String" => return AnyTsType::TsStringType(make::ts_string_type(make::token(T![string]))),
_ => {}
Expand Down
10 changes: 5 additions & 5 deletions crates/biome_text_size/src/schemars_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
//! bindings to the Workspace API
use crate::{TextRange, TextSize};
use schemars::{gen::SchemaGenerator, schema::Schema, JsonSchema};
use schemars::{r#gen::SchemaGenerator, schema::Schema, JsonSchema};

impl JsonSchema for TextSize {
fn schema_name() -> String {
String::from("TextSize")
}

fn json_schema(gen: &mut SchemaGenerator) -> Schema {
fn json_schema(generator: &mut SchemaGenerator) -> Schema {
// TextSize is represented as a raw u32, see serde_impls.rs for the
// actual implementation
<u32>::json_schema(gen)
<u32>::json_schema(generator)
}
}

Expand All @@ -25,9 +25,9 @@ impl JsonSchema for TextRange {
String::from("TextRange")
}

fn json_schema(gen: &mut SchemaGenerator) -> Schema {
fn json_schema(generator: &mut SchemaGenerator) -> Schema {
// TextSize is represented as (TextSize, TextSize), see serde_impls.rs
// for the actual implementation
<(TextSize, TextSize)>::json_schema(gen)
<(TextSize, TextSize)>::json_schema(generator)
}
}
2 changes: 1 addition & 1 deletion crates/biome_wasm/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use biome_js_formatter::{context::JsFormatOptions, format_node};
use biome_rowan::AstNode;
use biome_service::workspace_types::{generate_type, methods, ModuleQueue};
use quote::{format_ident, quote};
use schemars::gen::{SchemaGenerator, SchemaSettings};
use schemars::r#gen::{SchemaGenerator, SchemaSettings};
use std::{env, fs, io, path::PathBuf};

fn main() -> io::Result<()> {
Expand Down
4 changes: 2 additions & 2 deletions crates/tests_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ impl Arguments {
})
}

pub fn gen(&self) -> Result<TokenStream, &str> {
pub fn generate(&self) -> Result<TokenStream, &str> {
let files = self.get_all_files()?;
let mut modules = Modules::default();

Expand Down Expand Up @@ -247,7 +247,7 @@ impl syn::parse::Parse for Arguments {
pub fn gen_tests(input: TokenStream) -> TokenStream {
let args = syn::parse_macro_input!(input as Arguments);

match args.gen() {
match args.generate() {
Ok(tokens) => tokens,
Err(e) => abort!(e, "{}", e),
}
Expand Down

0 comments on commit 0de2546

Please sign in to comment.