Skip to content

FilmCraft: An open-source, nonlinear video editor written by scratch in pure Rust

media: importable tests after the items (clippy items_after_test_module, #677 follow-up)

Brandon Thomasfad5255dc91f
diff --git a/crates/media/src/lib.rs b/crates/media/src/lib.rs
index d65a06304..bfc94de79 100644
--- a/crates/media/src/lib.rs
+++ b/crates/media/src/lib.rs
@@ -180,20 +180,6 @@ pub fn is_importable(path: &Path) -> bool {
STILL_EXTENSIONS.contains(&ext.as_str()) || AUDIO_EXTENSIONS.contains(&ext.as_str()) || VIDEO_EXTENSIONS.contains(&ext.as_str())
}
-#[cfg(test)]
-mod importable_tests {
- use super::*;
- use std::path::Path;
-
- #[test]
- fn camera_extensions_match_regardless_of_case() {
- for name in ["clip.mov", "clip.MOV", "clip.Mov", "shot.MP4", "IMG_0001.JPG", "sound.WAV", "take.M2TS"] {
- assert!(is_importable(Path::new(name)), "{name}");
- }
- assert!(!is_importable(Path::new("notes.txt")));
- }
-}
-
/// A pluggable opener (containers/codecs register themselves here from higher-level crates).
pub type Opener = fn(name: &str, bytes: Arc<[u8]>) -> Option<Result<SharedSource>>;
@@ -244,3 +230,17 @@ impl MediaSource for OfflineSource {
Ok(AudioBuffer::silence(sample_rate, self.info.audio().map_or(2, |a| a.channels as usize), frames))
}
}
+
+#[cfg(test)]
+mod importable_tests {
+ use super::*;
+ use std::path::Path;
+
+ #[test]
+ fn camera_extensions_match_regardless_of_case() {
+ for name in ["clip.mov", "clip.MOV", "clip.Mov", "shot.MP4", "IMG_0001.JPG", "sound.WAV", "take.M2TS"] {
+ assert!(is_importable(Path::new(name)), "{name}");
+ }
+ assert!(!is_importable(Path::new("notes.txt")));
+ }
+}