mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-21 21:25:16 +00:00
Simplify snapshot code using match_file_name utility
This commit is contained in:
@@ -12,6 +12,7 @@ use super::{
|
||||
dir::SnapshotDir,
|
||||
meta_file::AdjacentMetadata,
|
||||
middleware::{SnapshotFileResult, SnapshotInstanceResult, SnapshotMiddleware},
|
||||
util::match_trailing,
|
||||
};
|
||||
|
||||
pub struct SnapshotLua;
|
||||
@@ -146,15 +147,6 @@ fn snapshot_init<F: ImfsFetcher>(
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
fn match_trailing<'a>(input: &'a str, trailer: &str) -> Option<&'a str> {
|
||||
if input.ends_with(trailer) {
|
||||
let end = input.len().saturating_sub(trailer.len());
|
||||
Some(&input[..end])
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user