mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-20 17:41:37 +00:00
Simplify snapshot code using match_file_name utility
This commit is contained in:
parent
6b620ddcef
commit
e46f9fd94f
6 changed files with 27 additions and 104 deletions
|
|
@ -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::*;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue