Skip to content

Commit

Permalink
chore(rust): upgrade to 1.84.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Dwlad90 committed Feb 1, 2025
1 parent dcaf015 commit 0568736
Show file tree
Hide file tree
Showing 16 changed files with 29 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"pnpmVersion": "9.15.4"
},
"ghcr.io/devcontainers/features/rust:1": {
"version": "1.82.0",
"version": "1.84.1",
"targets": [
"wasm32-wasip1",
"x86_64-apple-darwin",
Expand Down
2 changes: 1 addition & 1 deletion clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ ignore-interior-mutability = [
"swc_atoms::JsWord",
"swc_ecma_ast::Id",
]
msrv = "1.82.0"
msrv = "1.84.1"
type-complexity-threshold = 25000
2 changes: 1 addition & 1 deletion crates/stylex-path-resolver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "stylex_path_resolver"
version = "0.6.4-rc.1"
edition = "2021"
rust-version = "1.82.0"
rust-version = "1.84.1"
description = "Path resolver for StyleX SWC plugin"
license = "MIT"
repository = "https://github.com/Dwlad90/stylex-swc-plugin.git"
Expand Down
2 changes: 1 addition & 1 deletion crates/stylex-shared/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "stylex_shared"
version = "0.6.4-rc.1"
edition = "2021"
rust-version = "1.82.0"
rust-version = "1.84.1"
description = "Shared SWC tranformer for StyleX"
license = "MIT"
repository = "https://github.com/Dwlad90/stylex-swc-plugin.git"
Expand Down
10 changes: 4 additions & 6 deletions crates/stylex-shared/src/shared/structures/state_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,10 @@ impl StateManager {
if let Some(package_json_path) = package_json_path {
let (package_json, _) = get_package_json(&package_json_path, package_json_seen);
// Try to read and parse package.json
return Some((
Some((
package_json.name,
package_json_path.to_string_lossy().into_owned(),
));
))
} else {
// Recursively check parent directory if not at root
if folder.parent().is_some() && !folder.as_os_str().is_empty() {
Expand Down Expand Up @@ -481,8 +481,7 @@ impl StateManager {

// Update declarations
if let Some(item) = self.declarations.iter_mut().find(|decl| {
decl.init.as_ref().map_or(
false,
decl.init.as_ref().is_some_and(
|boxed_expr| matches!(**boxed_expr, Expr::Call(ref existing_call) if existing_call == call),
)
}) {
Expand All @@ -491,8 +490,7 @@ impl StateManager {

// Update style_vars
if let Some((_, item)) = self.style_vars.iter_mut().find(|(_, decl)| {
decl.init.as_ref().map_or(
false,
decl.init.as_ref().is_some_and(
|expr| matches!(**expr, Expr::Call(ref existing_call) if existing_call == call),
)
}) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ impl Default for StyleXOptionsParams {

#[derive(Deserialize, Debug, Clone, PartialEq)]
#[serde(rename_all(deserialize = "kebab-case", serialize = "PascalCase"))]

pub enum StyleResolution {
ApplicationOrder,
PropertySpecificity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,6 @@ mod stylex_create {

#[test]
#[ignore]

fn transforms_nested_pseudo_classes_within_pseudo_elements_v2() {
let before_hover_object = style_multiple_depth_nested_object_factory(&[(
"default",
Expand Down
2 changes: 1 addition & 1 deletion crates/stylex-shared/src/shared/utils/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ pub(crate) fn _get_var_decl_by_ident_or_member<'a>(
.and_then(|call| call.callee.as_expr())
.and_then(|callee| callee.as_member())
.and_then(|member| member.prop.as_ident())
.map_or(false, |member_ident| member_ident.sym == ident.sym)
.is_some_and(|member_ident| member_ident.sym == ident.sym)
})
.cloned()
}
Expand Down
4 changes: 2 additions & 2 deletions crates/stylex-shared/src/shared/utils/js/evaluate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1692,9 +1692,9 @@ fn _evaluate(
);
}
_ => {
debug!("Unsupported type of expression: {:?}", path);
warn!("Unsupported type of expression: {:?}. If its not enough, please run in debug mode to see more details", path.get_type());

warn!("Unsupported type of expression: {:?}", path.get_type());
debug!("Unsupported type of expression: {:?}", path);

return deopt(
path,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ impl<'a> ExpressionFinder<'a> {
}
}

impl<'a> Fold for ExpressionFinder<'a> {
impl Fold for ExpressionFinder<'_> {
fn fold_expr(&mut self, expr: Expr) -> Expr {
if self.target.eq_ignore_span(&expr) {
self.found_expr = Some(expr.clone());
Expand Down
8 changes: 4 additions & 4 deletions crates/stylex-shared/src/shared/utils/validators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,15 @@ pub(crate) fn is_target_call(
.callee
.as_expr()
.and_then(|arg| arg.as_ident())
.map_or(false, |ident| imports_map.contains(&ident.sym));
.is_some_and(|ident| imports_map.contains(&ident.sym));

let is_create_member = call
.callee
.as_expr()
.and_then(|expr| expr.as_member())
.map_or(false, |member| {
.is_some_and(|member| {
member.obj.is_ident()
&& member.prop.as_ident().map_or(false, |ident| {
&& member.prop.as_ident().is_some_and(|ident| {
ident.sym == call_name
&& state.stylex_import_stringified().contains(
&member
Expand Down Expand Up @@ -504,7 +504,7 @@ pub(crate) fn validate_theme_variables(
return key_value;
}

if !variables.as_expr().map_or(false, |expr| expr.is_object()) {
if !variables.as_expr().is_some_and(|expr| expr.is_object()) {
panic!("Can only override variables theme created with stylex.defineVars().");
}

Expand Down
6 changes: 3 additions & 3 deletions crates/stylex-shared/src/transform/fold/fold_module_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ where
.filter(|decl| {
decl
.init
.as_ref() // Use as_ref to convert Option<T> to Option<&T>
.map_or(false, |init| init.is_object() || init.is_lit())
.as_ref()
.is_some_and(|init| init.is_object() || init.is_lit())
})
.cloned() // Clone only the filtered elements
.collect::<Vec<VarDeclarator>>()
Expand All @@ -107,7 +107,7 @@ where
decl
.init
.as_ref()
.map_or(false, |init| init.is_object() || init.is_lit())
.is_some_and(|init| init.is_object() || init.is_lit())
})
.cloned()
.collect::<Vec<VarDeclarator>>(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,8 @@ where
let expr = dynamic_match
.iter()
.find(|dynamic_style| {
orig_class_paths
.get(&cls.to_string())
.map_or(false, |path| path == &dynamic_style.path)
orig_class_paths.get(&cls.to_string())
== Some(&dynamic_style.path)
})
.map(|dynamic_style| {
let expression = &dynamic_style.expression;
Expand All @@ -354,9 +353,8 @@ where
}
} else if class_list.iter().any(|cls| {
dynamic_match.iter().any(|dynamic_style| {
orig_class_paths
.get(&cls.to_string())
.map_or(false, |path| path == &dynamic_style.path)
orig_class_paths.get(&cls.to_string())
== Some(&dynamic_style.path)
})
}) {
let expr_array: Vec<Expr> = class_list
Expand All @@ -366,9 +364,8 @@ where
let expr = dynamic_match
.iter()
.find(|dynamic_style| {
orig_class_paths
.get(&cls.to_string())
.map_or(false, |path| path == &dynamic_style.path)
orig_class_paths.get(&cls.to_string())
== Some(&dynamic_style.path)
})
.map(|dynamic_style| dynamic_style.expression.clone());

Expand Down
2 changes: 1 addition & 1 deletion crates/stylex-test-parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "stylex_test_parser"
version = "0.6.4-rc.1"
edition = "2021"
rust-version = "1.82.0"
rust-version = "1.84.1"
description = "Test parser for StyleX"
license = "MIT"
repository = "https://github.com/Dwlad90/stylex-swc-plugin.git"
Expand Down
4 changes: 2 additions & 2 deletions crates/stylex-test-parser/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ fn main() {

let packages = ["babel-plugin", "shared", "stylex", "open-props"];

let re = Regex::new(r"(test\.js|test\.js\.snap)$").unwrap();

for package in packages.iter() {
let path = format!("{}/{}", stylex_dir, package);
let root_path = Path::new(path.as_str());
Expand All @@ -213,8 +215,6 @@ fn main() {
}
};

let re = Regex::new(r"(test\.js|test\.js\.snap)$").unwrap();

let file_paths = file_paths
.into_iter()
.filter(|f| {
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
channel = "1.82.0"
channel = "1.84.1"
components = ["rustfmt", "clippy"]
targets = [
"wasm32-wasip1",
Expand Down

0 comments on commit 0568736

Please sign in to comment.