Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update rust to 1.77.0 #2154

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ resolver = "2"

[workspace.lints.rust]
absolute_paths_not_starting_with_crate = "warn"
dead_code = "warn"
trivial_numeric_casts = "warn"
unused_import_braces = "warn"
unused_lifetimes = "warn"
unused_macro_rules = "warn"
unused_tuple_struct_fields = "warn"

[workspace.lints.clippy]
cargo_common_metadata = "allow"
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_analyze/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl AnalyzerOptions {
self.configuration
.rules
.get_rule_options::<R::Options>(&RuleKey::rule::<R>())
.map(R::Options::clone)
.cloned()
}

pub fn preferred_quote(&self) -> &PreferredQuote {
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_diagnostics/src/display/backtrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ thread_local! {
/// will be the address of the `main` function, while on worker threads
/// this will be the start function for the thread (see the documentation
/// of [set_bottom_frame] for examples of where to set the bottom frame).
static BOTTOM_FRAME: Cell<Option<usize>> = Cell::new(None);
static BOTTOM_FRAME: Cell<Option<usize>> = const { Cell::new(None) };
}

/// Registers a function pointer as the "bottom frame" for this thread: all
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_diagnostics/src/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub struct PanicError {
}

thread_local! {
static LAST_PANIC: std::cell::Cell<Option<PanicError>> = std::cell::Cell::new(None);
static LAST_PANIC: std::cell::Cell<Option<PanicError>> = const { std::cell::Cell::new(None) };
}

impl std::fmt::Display for PanicError {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,8 @@ impl Rule for NoUselessConstructor {
// There are more than one statement.
return None;
}
let Some(js_expr) = first.as_js_expression_statement()?.expression().ok() else {
return None;
};
let Some(js_call) = js_expr.as_js_call_expression() else {
return None;
};
let js_expr = first.as_js_expression_statement()?.expression().ok()?;
let js_call = js_expr.as_js_call_expression()?;
let is_super_call = js_call.callee().ok()?.as_js_super_expression().is_some();
if !is_super_call {
return None;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,29 +134,22 @@ impl Rule for NoUselessThisAlias {
fn action(ctx: &RuleContext<Self>, id: &Self::State) -> Option<JsRuleAction> {
let declarator = ctx.query();
let model = ctx.model();
let Some(var_decl) = declarator
let var_decl = declarator
.syntax()
.ancestors()
.find_map(JsVariableDeclaration::cast)
else {
return None;
};
.find_map(JsVariableDeclaration::cast)?;
let mut mutation = ctx.root().begin();
let this_expr = AnyJsExpression::from(make::js_this_expression(make::token(T![this])));
for read in id.all_reads(model) {
let syntax = read.syntax();
let syntax = syntax.parent()?;
let Some(expr) = JsIdentifierExpression::cast(syntax) else {
return None;
};
let expr = JsIdentifierExpression::cast(syntax)?;
mutation.replace_node(expr.into(), this_expr.clone());
}
for write in id.all_writes(model) {
let syntax = write.syntax();
let syntax = syntax.parent()?;
let Some(statement) = JsExpressionStatement::cast(syntax.parent()?) else {
return None;
};
let statement = JsExpressionStatement::cast(syntax.parent()?)?;
mutation.remove_node(statement);
}
let var_declarator_list = var_decl.declarators();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,7 @@ impl Rule for NoUnusedVariables {
return None;
}

let Some(suggestion) = suggested_fix_if_unused(binding) else {
return None;
};
let suggestion = suggested_fix_if_unused(binding)?;

let model = ctx.model();
if model.is_exported(binding) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ impl Rule for NoDuplicateJsonKeys {
.collect();

if !duplicated_keys.is_empty() {
let Some(original_key) = original_key else {
return None;
};
let original_key = original_key?;

return Some(DuplicatedKeys {
original_key,
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# The default profile includes rustc, rust-std, cargo, rust-docs, rustfmt and clippy.
# https://rust-lang.github.io/rustup/concepts/profiles.html
profile = "default"
channel = "1.76.0"
channel = "1.77.0"
Loading