mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 14:01:37 +00:00
Refactor code for improved readability by consolidating multi-line statements into single lines across various modules, including JSON serialization, snapshot middleware, and file name validation.
This commit is contained in:
parent
4caac7a31c
commit
2dfcac4ef7
8 changed files with 32 additions and 25 deletions
|
|
@ -48,7 +48,10 @@ pub fn name_for_inst<'old>(
|
|||
encoded
|
||||
} else {
|
||||
validate_file_name(&new_inst.name).with_context(|| {
|
||||
format!("name '{}' is not legal to write to the file system", new_inst.name)
|
||||
format!(
|
||||
"name '{}' is not legal to write to the file system",
|
||||
new_inst.name
|
||||
)
|
||||
})?;
|
||||
new_inst.name.clone()
|
||||
};
|
||||
|
|
@ -65,7 +68,10 @@ pub fn name_for_inst<'old>(
|
|||
encoded
|
||||
} else {
|
||||
validate_file_name(&new_inst.name).with_context(|| {
|
||||
format!("name '{}' is not legal to write to the file system", new_inst.name)
|
||||
format!(
|
||||
"name '{}' is not legal to write to the file system",
|
||||
new_inst.name
|
||||
)
|
||||
})?;
|
||||
new_inst.name.clone()
|
||||
};
|
||||
|
|
|
|||
|
|
@ -369,8 +369,8 @@ pub fn get_best_middleware(snapshot: &SyncbackSnapshot) -> Middleware {
|
|||
middleware = Middleware::JsonModel;
|
||||
} else {
|
||||
middleware = match inst.class.as_str() {
|
||||
"Folder" | "Configuration" | "Tool"
|
||||
| "ScreenGui" | "SurfaceGui" | "BillboardGui" | "AdGui" => Middleware::Dir,
|
||||
"Folder" | "Configuration" | "Tool" | "ScreenGui" | "SurfaceGui" | "BillboardGui"
|
||||
| "AdGui" => Middleware::Dir,
|
||||
"StringValue" => Middleware::Text,
|
||||
"Script" => Middleware::ServerScript,
|
||||
"LocalScript" => Middleware::ClientScript,
|
||||
|
|
@ -478,8 +478,9 @@ impl SyncbackRules {
|
|||
let mut globs = Vec::with_capacity(self.ignore_trees.len());
|
||||
|
||||
for pattern in &self.ignore_trees {
|
||||
let glob = Glob::new(pattern)
|
||||
.with_context(|| format!("the pattern '{pattern}' is not a valid ignoreTrees glob"))?;
|
||||
let glob = Glob::new(pattern).with_context(|| {
|
||||
format!("the pattern '{pattern}' is not a valid ignoreTrees glob")
|
||||
})?;
|
||||
globs.push(glob);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -249,7 +249,9 @@ impl<'sync> SyncbackSnapshot<'sync> {
|
|||
// Try glob matching first, fall back to prefix matching for backwards compatibility
|
||||
if let Ok(glob) = Glob::new(pattern) {
|
||||
if glob.is_match(&path) {
|
||||
log::debug!("Ignoring {path} because it matches ignoreTrees glob: {pattern}");
|
||||
log::debug!(
|
||||
"Ignoring {path} because it matches ignoreTrees glob: {pattern}"
|
||||
);
|
||||
return true;
|
||||
}
|
||||
} else if path.starts_with(pattern.as_str()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue