mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
Update submodule reference and refactor match statements for improved clarity
- Updated the rbx-dom submodule to the latest commit. - Refactored match statements in resolution.rs, sourcemap.rs, project.rs, and api.rs to dereference names directly for better readability.
This commit is contained in:
parent
181a003ad2
commit
64d21dc6d6
5 changed files with 9 additions and 10 deletions
2
rbx-dom
2
rbx-dom
|
|
@ -1 +1 @@
|
||||||
Subproject commit 188dc9da72de70452909b0c5f67d9a42c9dbad05
|
Subproject commit bd865f3b54d7d46bd049501552c8b775d716ade9
|
||||||
|
|
@ -214,16 +214,15 @@ fn recurse_create_node<'a>(
|
||||||
Vec::with_capacity(instance.metadata().relevant_paths.len());
|
Vec::with_capacity(instance.metadata().relevant_paths.len());
|
||||||
|
|
||||||
// Canonicalize project_dir once to normalize Windows \\?\ prefixes
|
// Canonicalize project_dir once to normalize Windows \\?\ prefixes
|
||||||
let canonical_project_dir = std::fs::canonicalize(project_dir)
|
let canonical_project_dir =
|
||||||
.unwrap_or_else(|_| project_dir.to_path_buf());
|
std::fs::canonicalize(project_dir).unwrap_or_else(|_| project_dir.to_path_buf());
|
||||||
|
|
||||||
for val in file_paths {
|
for val in file_paths {
|
||||||
if use_absolute_paths {
|
if use_absolute_paths {
|
||||||
let abs_path = path::absolute(val).expect(ABSOLUTE_PATH_FAILED_ERR);
|
let abs_path = path::absolute(val).expect(ABSOLUTE_PATH_FAILED_ERR);
|
||||||
output_file_paths.push(Cow::Owned(abs_path));
|
output_file_paths.push(Cow::Owned(abs_path));
|
||||||
} else {
|
} else {
|
||||||
let canonical_val = std::fs::canonicalize(val)
|
let canonical_val = std::fs::canonicalize(val).unwrap_or_else(|_| val.to_path_buf());
|
||||||
.unwrap_or_else(|_| val.to_path_buf());
|
|
||||||
output_file_paths.push(Cow::Owned(
|
output_file_paths.push(Cow::Owned(
|
||||||
pathdiff::diff_paths(&canonical_val, &canonical_project_dir)
|
pathdiff::diff_paths(&canonical_val, &canonical_project_dir)
|
||||||
.expect("Failed to compute relative path from project dir"),
|
.expect("Failed to compute relative path from project dir"),
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,7 @@ impl AmbiguousValue {
|
||||||
|
|
||||||
(VariantType::String, AmbiguousValue::String(value)) => Ok(value.into()),
|
(VariantType::String, AmbiguousValue::String(value)) => Ok(value.into()),
|
||||||
(VariantType::Tags, AmbiguousValue::StringArray(value)) => {
|
(VariantType::Tags, AmbiguousValue::StringArray(value)) => {
|
||||||
Ok(Tags::from(value).into())
|
Ok(value.iter().map(String::as_str).collect::<Tags>().into())
|
||||||
}
|
}
|
||||||
(VariantType::Content, AmbiguousValue::String(value)) => {
|
(VariantType::Content, AmbiguousValue::String(value)) => {
|
||||||
Ok(Content::from(value).into())
|
Ok(Content::from(value).into())
|
||||||
|
|
@ -304,7 +304,7 @@ fn find_descriptor(
|
||||||
return Some(descriptor);
|
return Some(descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
current_class_name = class.superclass.as_deref()?;
|
current_class_name = class.superclass?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ fn middleware_for_script(inst: &Instance) -> Middleware {
|
||||||
if let (Some(enums), Some(value)) = (run_context_enums, run_context_value) {
|
if let (Some(enums), Some(value)) = (run_context_enums, run_context_value) {
|
||||||
for (name, &enum_value) in enums {
|
for (name, &enum_value) in enums {
|
||||||
if enum_value == value {
|
if enum_value == value {
|
||||||
return match name.as_ref() {
|
return match *name {
|
||||||
"Server" => Middleware::ServerScriptDir,
|
"Server" => Middleware::ServerScriptDir,
|
||||||
"Client" => Middleware::ClientScriptDir,
|
"Client" => Middleware::ClientScriptDir,
|
||||||
"Plugin" => Middleware::PluginScriptDir,
|
"Plugin" => Middleware::PluginScriptDir,
|
||||||
|
|
|
||||||
|
|
@ -2108,7 +2108,7 @@ impl ApiService {
|
||||||
// Find which RunContext this value corresponds to
|
// Find which RunContext this value corresponds to
|
||||||
for (name, &enum_value) in enums {
|
for (name, &enum_value) in enums {
|
||||||
if enum_value == value {
|
if enum_value == value {
|
||||||
return match name.as_ref() {
|
return match *name {
|
||||||
"Client" => "client",
|
"Client" => "client",
|
||||||
"Server" => "server",
|
"Server" => "server",
|
||||||
"Legacy" => "legacy",
|
"Legacy" => "legacy",
|
||||||
|
|
@ -3711,7 +3711,7 @@ mod tests {
|
||||||
if let (Some(enums), Some(value)) = (run_context_enums, run_context_value) {
|
if let (Some(enums), Some(value)) = (run_context_enums, run_context_value) {
|
||||||
for (name, &enum_value) in enums {
|
for (name, &enum_value) in enums {
|
||||||
if enum_value == value {
|
if enum_value == value {
|
||||||
return match name.as_ref() {
|
return match *name {
|
||||||
"Client" => "client",
|
"Client" => "client",
|
||||||
"Server" => "server",
|
"Server" => "server",
|
||||||
"Legacy" => "legacy",
|
"Legacy" => "legacy",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue