diff --git a/apps/desktop/src-tauri/src/audio.rs b/apps/desktop/src-tauri/src/audio.rs index 354436a8..b9f05e70 100644 --- a/apps/desktop/src-tauri/src/audio.rs +++ b/apps/desktop/src-tauri/src/audio.rs @@ -28,10 +28,10 @@ impl AppSounds { fn get_sound_bytes(&self) -> &'static [u8] { match self { - AppSounds::StartRecording => include_bytes!("../sounds/start-recording.ogg"), - AppSounds::StopRecording => include_bytes!("../sounds/stop-recording.ogg"), - AppSounds::Screenshot => include_bytes!("../sounds/screenshot.ogg"), - AppSounds::Notification => include_bytes!("../sounds/action.ogg"), + Self::StartRecording => include_bytes!("../sounds/start-recording.ogg"), + Self::StopRecording => include_bytes!("../sounds/stop-recording.ogg"), + Self::Screenshot => include_bytes!("../sounds/screenshot.ogg"), + Self::Notification => include_bytes!("../sounds/action.ogg"), } } } diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rs index 28fdb46f..d6eea7ca 100644 --- a/apps/desktop/src-tauri/src/lib.rs +++ b/apps/desktop/src-tauri/src/lib.rs @@ -1587,7 +1587,7 @@ fn list_recordings(app: AppHandle) -> Result (&'static str, &'static str, bool) { match self { - NotificationType::VideoSaved => ("Video Saved", "Video saved successfully", false), - NotificationType::VideoCopiedToClipboard => { - ("Video Copied", "Video copied to clipboard", false) - } - NotificationType::ShareableLinkCopied => { - ("Link Copied", "Link copied to clipboard", false) - } - NotificationType::UploadFailed => ( + Self::VideoSaved => ("Video Saved", "Video saved successfully", false), + Self::VideoCopiedToClipboard => ("Video Copied", "Video copied to clipboard", false), + Self::ShareableLinkCopied => ("Link Copied", "Link copied to clipboard", false), + Self::UploadFailed => ( "Upload Failed", "Unable to upload media. Please try again", true, ), - NotificationType::VideoSaveFailed => ( + Self::VideoSaveFailed => ( "Save Failed", "Unable to save video. Please try again", true, ), - NotificationType::VideoCopyFailed => ( + Self::VideoCopyFailed => ( "Copy Failed", "Unable to copy video to clipboard. Please try again", true, ), - NotificationType::ShareableLinkFailed => ( + Self::ShareableLinkFailed => ( "Share Failed", "Unable to create shareable link. Please try again", true, ), - NotificationType::ScreenshotSaved => { - ("Screenshot Saved", "Screenshot saved successfully", false) - } - NotificationType::ScreenshotCopiedToClipboard => { + Self::ScreenshotSaved => ("Screenshot Saved", "Screenshot saved successfully", false), + Self::ScreenshotCopiedToClipboard => { ("Screenshot Copied", "Screenshot copied to clipboard", false) } - NotificationType::ScreenshotSaveFailed => ( + Self::ScreenshotSaveFailed => ( "Save Failed", "Unable to save screenshot. Please try again", true, ), - NotificationType::ScreenshotCopyFailed => ( + Self::ScreenshotCopyFailed => ( "Copy Failed", "Unable to copy screenshot to clipboard. Please try again", true, @@ -66,7 +60,7 @@ impl NotificationType { pub fn message(&self) -> &'static str { match self { - NotificationType::UploadFailed => { + Self::UploadFailed => { "Failed to upload your video after multiple attempts. Please try again later." } _ => "", @@ -75,7 +69,7 @@ impl NotificationType { pub fn title(&self) -> &'static str { match self { - NotificationType::UploadFailed => "Upload Failed", + Self::UploadFailed => "Upload Failed", _ => "", } } diff --git a/apps/desktop/src-tauri/src/permissions.rs b/apps/desktop/src-tauri/src/permissions.rs index 92ae3f99..19c04d92 100644 --- a/apps/desktop/src-tauri/src/permissions.rs +++ b/apps/desktop/src-tauri/src/permissions.rs @@ -100,10 +100,7 @@ pub enum OSPermissionStatus { impl OSPermissionStatus { pub fn permitted(&self) -> bool { - match self { - Self::NotNeeded | Self::Granted => true, - _ => false, - } + matches!(*self, Self::NotNeeded | Self::Granted) } } diff --git a/apps/desktop/src-tauri/src/upload.rs b/apps/desktop/src-tauri/src/upload.rs index 2c9cae75..36164280 100644 --- a/apps/desktop/src-tauri/src/upload.rs +++ b/apps/desktop/src-tauri/src/upload.rs @@ -782,7 +782,7 @@ async fn compress_image(path: PathBuf) -> Result, String> { let resized_img = img.resize(new_width, new_height, image::imageops::FilterType::Nearest); - let mut buffer = Vec::new(); + let mut buffer = vec![]; let mut encoder = JpegEncoder::new_with_quality(&mut buffer, 30); encoder .encode( @@ -855,7 +855,7 @@ impl ProgressiveUploadTask { let s3_config = pre_created_video.config; let file_key = format!("{}/{}/{}", s3_config.user_id(), s3_config.id(), file_name); - let mut uploaded_parts = Vec::new(); + let mut uploaded_parts = vec![]; let mut part_number = 1; let mut last_uploaded_position: u64 = 0; diff --git a/apps/desktop/src-tauri/src/windows.rs b/apps/desktop/src-tauri/src/windows.rs index 08770ba4..c64e1ab0 100644 --- a/apps/desktop/src-tauri/src/windows.rs +++ b/apps/desktop/src-tauri/src/windows.rs @@ -82,16 +82,17 @@ impl CapWindowId { pub fn title(&self) -> String { match self { - Self::Setup => "Cap Setup".to_string(), - Self::Settings => "Cap Settings".to_string(), - Self::WindowCaptureOccluder => "Cap Window Capture Occluder".to_string(), - Self::CaptureArea => "Cap Capture Area".to_string(), - Self::InProgressRecording => "Cap In Progress Recording".to_string(), - Self::Editor { .. } => "Cap Editor".to_string(), - Self::SignIn => "Cap Sign In".to_string(), - Self::ModeSelect => "Cap Mode Selection".to_string(), - _ => "Cap".to_string(), + Self::Setup => "Cap Setup", + Self::Settings => "Cap Settings", + Self::WindowCaptureOccluder => "Cap Window Capture Occluder", + Self::CaptureArea => "Cap Capture Area", + Self::InProgressRecording => "Cap In Progress Recording", + Self::Editor { .. } => "Cap Editor", + Self::SignIn => "Cap Sign In", + Self::ModeSelect => "Cap Mode Selection", + _ => "Cap", } + .to_string() } pub fn activates_dock(&self) -> bool { @@ -483,20 +484,20 @@ impl ShowCapWindow { pub fn id(&self) -> CapWindowId { match self { - ShowCapWindow::Setup => CapWindowId::Setup, - ShowCapWindow::Main => CapWindowId::Main, - ShowCapWindow::Settings { .. } => CapWindowId::Settings, - ShowCapWindow::Editor { project_id } => CapWindowId::Editor { + Self::Setup => CapWindowId::Setup, + Self::Main => CapWindowId::Main, + Self::Settings { .. } => CapWindowId::Settings, + Self::Editor { project_id } => CapWindowId::Editor { project_id: project_id.clone(), }, - ShowCapWindow::RecordingsOverlay => CapWindowId::RecordingsOverlay, - ShowCapWindow::WindowCaptureOccluder => CapWindowId::WindowCaptureOccluder, - ShowCapWindow::CaptureArea { .. } => CapWindowId::CaptureArea, - ShowCapWindow::Camera { .. } => CapWindowId::Camera, - ShowCapWindow::InProgressRecording { .. } => CapWindowId::InProgressRecording, - ShowCapWindow::Upgrade => CapWindowId::Upgrade, - ShowCapWindow::SignIn => CapWindowId::SignIn, - ShowCapWindow::ModeSelect => CapWindowId::ModeSelect, + Self::RecordingsOverlay => CapWindowId::RecordingsOverlay, + Self::WindowCaptureOccluder => CapWindowId::WindowCaptureOccluder, + Self::CaptureArea { .. } => CapWindowId::CaptureArea, + Self::Camera { .. } => CapWindowId::Camera, + Self::InProgressRecording { .. } => CapWindowId::InProgressRecording, + Self::Upgrade => CapWindowId::Upgrade, + Self::SignIn => CapWindowId::SignIn, + Self::ModeSelect => CapWindowId::ModeSelect, } } } diff --git a/crates/media/src/feeds/camera.rs b/crates/media/src/feeds/camera.rs index d1cc2b06..b019bce2 100644 --- a/crates/media/src/feeds/camera.rs +++ b/crates/media/src/feeds/camera.rs @@ -77,7 +77,7 @@ impl CameraFeed { .into_iter() .map(|i| i.human_name().to_string()) .collect::>(), - Err(_) => Vec::new(), + Err(_) => vec![], } } diff --git a/crates/media/src/platform/macos.rs b/crates/media/src/platform/macos.rs index 256cd720..681db541 100644 --- a/crates/media/src/platform/macos.rs +++ b/crates/media/src/platform/macos.rs @@ -29,7 +29,7 @@ extern "C" { } pub fn get_on_screen_windows() -> Vec { - let mut windows = Vec::new(); + let mut windows = vec![]; unsafe { let cf_win_array = CGWindowListCopyWindowInfo( diff --git a/crates/media/src/platform/win.rs b/crates/media/src/platform/win.rs index 36f0b5a5..90e74f9c 100644 --- a/crates/media/src/platform/win.rs +++ b/crates/media/src/platform/win.rs @@ -93,7 +93,7 @@ impl Default for DefaultCursors { .0 } - DefaultCursors { + Self { arrow: load_cursor(IDC_ARROW), ibeam: load_cursor(IDC_IBEAM), cross: load_cursor(IDC_CROSS), diff --git a/crates/media/src/sources/audio_mixer.rs b/crates/media/src/sources/audio_mixer.rs index 32b26e19..2e040379 100644 --- a/crates/media/src/sources/audio_mixer.rs +++ b/crates/media/src/sources/audio_mixer.rs @@ -8,9 +8,7 @@ pub struct AudioMixer { impl AudioMixer { pub fn new() -> Self { - Self { - sources: Vec::new(), - } + Self { sources: vec![] } } pub fn sink(&mut self, info: AudioInfo) -> AudioMixerSink { diff --git a/crates/media/src/sources/screen_capture.rs b/crates/media/src/sources/screen_capture.rs index 2b0752f9..3e3336bb 100644 --- a/crates/media/src/sources/screen_capture.rs +++ b/crates/media/src/sources/screen_capture.rs @@ -61,15 +61,15 @@ impl ScreenCaptureTarget { let targets = scap::get_all_targets(); match self { - ScreenCaptureTarget::Window { id } => targets.into_iter().find(|t| match t { + Self::Window { id } => targets.into_iter().find(|t| match t { scap::Target::Window(window) => window.id == *id, _ => false, }), - ScreenCaptureTarget::Screen { id } => targets.into_iter().find(|t| match t { + Self::Screen { id } => targets.into_iter().find(|t| match t { scap::Target::Display(screen) => screen.id == *id, _ => false, }), - ScreenCaptureTarget::Area { screen, .. } => targets.into_iter().find(|t| match t { + Self::Area { screen, .. } => targets.into_iter().find(|t| match t { scap::Target::Display(display) => display.id == *screen, _ => false, }), diff --git a/crates/project/src/configuration.rs b/crates/project/src/configuration.rs index 9c710e4c..1dd23acc 100644 --- a/crates/project/src/configuration.rs +++ b/crates/project/src/configuration.rs @@ -45,7 +45,7 @@ fn default_gradient_angle() -> u16 { impl Default for BackgroundSource { fn default() -> Self { - BackgroundSource::Wallpaper { + Self::Wallpaper { path: Some("sequoia-dark".to_string()), } } @@ -453,7 +453,7 @@ impl ProjectConfiguration { impl Default for ProjectConfiguration { fn default() -> Self { - ProjectConfiguration { + Self { aspect_ratio: None, background: BackgroundConfiguration::default(), camera: Camera::default(), diff --git a/crates/project/src/meta.rs b/crates/project/src/meta.rs index b92b0ead..893be58f 100644 --- a/crates/project/src/meta.rs +++ b/crates/project/src/meta.rs @@ -125,10 +125,8 @@ pub enum StudioRecordingMeta { impl StudioRecordingMeta { pub fn camera_path(&self) -> Option { match self { - StudioRecordingMeta::SingleSegment { segment } => { - segment.camera.as_ref().map(|c| c.path.clone()) - } - StudioRecordingMeta::MultipleSegments { inner } => inner + Self::SingleSegment { segment } => segment.camera.as_ref().map(|c| c.path.clone()), + Self::MultipleSegments { inner } => inner .segments .first() .and_then(|s| s.camera.as_ref().map(|c| c.path.clone())), @@ -137,8 +135,8 @@ impl StudioRecordingMeta { pub fn min_fps(&self) -> u32 { match self { - StudioRecordingMeta::SingleSegment { segment } => segment.display.fps, - StudioRecordingMeta::MultipleSegments { inner } => { + Self::SingleSegment { segment } => segment.display.fps, + Self::MultipleSegments { inner } => { inner.segments.iter().map(|s| s.display.fps).min().unwrap() } } @@ -146,8 +144,8 @@ impl StudioRecordingMeta { pub fn max_fps(&self) -> u32 { match self { - StudioRecordingMeta::SingleSegment { segment } => segment.display.fps, - StudioRecordingMeta::MultipleSegments { inner } => { + Self::SingleSegment { segment } => segment.display.fps, + Self::MultipleSegments { inner } => { inner.segments.iter().map(|s| s.display.fps).max().unwrap() } } @@ -186,8 +184,8 @@ pub enum Cursors { impl Cursors { fn is_empty(&self) -> bool { match self { - Cursors::Old(map) => map.is_empty(), - Cursors::Correct(map) => map.is_empty(), + Self::Old(map) => map.is_empty(), + Self::Correct(map) => map.is_empty(), } } } diff --git a/crates/recording/src/cursor.rs b/crates/recording/src/cursor.rs index 4a1296f0..6f6822f8 100644 --- a/crates/recording/src/cursor.rs +++ b/crates/recording/src/cursor.rs @@ -675,7 +675,7 @@ fn get_cursor_image_data() -> Option { }; // Convert to PNG format - let mut png_data = Vec::new(); + let mut png_data = vec![]; trimmed_image .write_to( &mut std::io::Cursor::new(&mut png_data), diff --git a/crates/recording/src/studio_recording.rs b/crates/recording/src/studio_recording.rs index c0a7da0c..13466433 100644 --- a/crates/recording/src/studio_recording.rs +++ b/crates/recording/src/studio_recording.rs @@ -176,7 +176,7 @@ pub async fn spawn_studio_recording_actor( recording_dir, options: options.clone(), fps, - segments: Vec::new(), + segments: vec![], }; let mut state = StudioRecordingActorState::Recording { diff --git a/crates/rendering/src/decoder/avassetreader.rs b/crates/rendering/src/decoder/avassetreader.rs index 8548c165..06b5520c 100644 --- a/crates/rendering/src/decoder/avassetreader.rs +++ b/crates/rendering/src/decoder/avassetreader.rs @@ -25,7 +25,7 @@ enum CachedFrame { impl CachedFrame { fn process(&mut self) -> Arc> { match self { - CachedFrame::Raw(image_buf) => { + Self::Raw(image_buf) => { let format = pixel_format_to_pixel(image_buf.pixel_format()); let data = if matches!(format, format::Pixel::RGBA) { @@ -167,7 +167,7 @@ impl CachedFrame { data } - CachedFrame::Processed(data) => data.clone(), + Self::Processed(data) => data.clone(), } } } diff --git a/crates/rendering/src/zoom.rs b/crates/rendering/src/zoom.rs index d626ea5f..fd6980ac 100644 --- a/crates/rendering/src/zoom.rs +++ b/crates/rendering/src/zoom.rs @@ -82,7 +82,7 @@ impl SegmentBounds { } pub fn default() -> Self { - SegmentBounds::new(XY::new(0.0, 0.0), XY::new(1.0, 1.0)) + Self::new(XY::new(0.0, 0.0), XY::new(1.0, 1.0)) } }