Repository: biomejs/biome (language: rust)

Issue:
📎 Clean up `WorkspaceError`
### Description

The `WorkspaceError` enum contains multiple variants that are never used. Examples are `ReportNotSerializable` and `DirtyWorkspace`, but there may be more. Any variant that is unused can be safely cleaned up from the repository.


Discussion / hints:
I'd like to take this up :)
All yours @sikehish 

Feel free to ask any questions you have here

Fix patch:
diff --git a/crates/biome_service/src/diagnostics.rs b/crates/biome_service/src/diagnostics.rs
index cc6f1c38e896..9a74690564ce 100644
--- a/crates/biome_service/src/diagnostics.rs
+++ b/crates/biome_service/src/diagnostics.rs
@@ -23,10 +23,6 @@ use std::process::{ExitCode, Termination};
 /// Generic errors thrown during biome operations
 #[derive(Deserialize, Diagnostic, Serialize)]
 pub enum WorkspaceError {
-    /// Can't export the report of the CLI into a file
-    ReportNotSerializable(ReportNotSerializable),
-    /// The project contains uncommitted changes
-    DirtyWorkspace(DirtyWorkspace),
     /// The file does not exist in the [crate::Workspace]
     NotFound(NotFound),
     /// A file is not supported. It contains the language and path of the file
@@ -40,8 +36,6 @@ pub enum WorkspaceError {
     FormatWithErrorsDisabled(FormatWithErrorsDisabled),
     /// The file could not be analyzed because a rule caused an error.
     RuleError(RuleError),
-    /// Thrown when Biome can't read a generic directory
-    CantReadDirectory(CantReadDirectory),
     /// Thrown when Biome can't read a generic file
     CantReadFile(CantReadFile),
     /// Error thrown when validating the configuration. Once deserialized, further checks have to be done.
@@ -171,25 +165,6 @@ impl From<CantLoadExtendFile> for WorkspaceError {
     }
 }
 
-#[derive(Debug, Serialize, Deserialize, Diagnostic)]
-#[diagnostic(
-    category = "internalError/fs",
-    message = "Uncommitted changes in repository"
-)]
-pub struct DirtyWorkspace;
-
-#[derive(Debug, Serialize, Deserialize, Diagnostic)]
-#[diagnostic(
-    category = "internalError/fs",
-    message(
-        message("The report can't be serialized, here's why: "{self.reason}),
-        description = "The report can't be serialized, here's why: {reason}"
-    )
-)]
-pub struct ReportNotSerializable {
-    reason: String,
-}
-
 #[derive(Debug, Serialize, Deserialize, Diagnostic)]
 #[diagnostic(
     category = "internalError/fs",
@@ -205,19 +180,6 @@ pub struct NotFound;
 )]
 pub struct FormatWithErrorsDisabled;
 
-#[derive(Debug, Serialize, Deserialize, Diagnostic)]
-#[diagnostic(
-    category = "internalError/fs",
-    message(
-        message("Biome couldn't read the following directory, maybe for permissions reasons or it doesn't exist: "{self.path}),
-        description = "Biome couldn't read the following directory, maybe for permissions reasons or it doesn't exist: {path}"
-    )
-)]
-pub struct CantReadDirectory {
-    #[location(resource)]
-    path: String,
-}
-
 #[derive(Debug, Serialize, Deserialize, Diagnostic)]
 #[diagnostic(
     category = "internalError/fs",
@@ -538,8 +500,7 @@ impl Advices for ProtectedFileAdvice {
 #[cfg(test)]
 mod test {
     use crate::diagnostics::{
-        CantReadDirectory, CantReadFile, DirtyWorkspace, FileIgnored, FileTooLarge, NotFound,
-        SourceFileNotSupported,
+        CantReadFile, FileIgnored, FileTooLarge, NotFound, SourceFileNotSupported,
     };
     use crate::file_handlers::DocumentFileSource;
     use crate::{TransportError, WorkspaceError};
@@ -564,14 +525,6 @@ mod test {
         assert_eq!(std::mem::size_of::<WorkspaceError>(), 96)
     }
 
-    #[test]
-    fn dirty_workspace() {
-        snap_diagnostic(
-            "dirty_workspace",
-            WorkspaceError::DirtyWorkspace(DirtyWorkspace).into(),
-        )
-    }
-
     #[test]
     fn file_ignored() {
         snap_diagnostic(
@@ -583,17 +536,6 @@ mod test {
         )
     }
 
-    #[test]
-    fn cant_read_directory() {
-        snap_diagnostic(
-            "cant_read_directory",
-            WorkspaceError::CantReadDirectory(CantReadDirectory {
-                path: "example/".to_string(),
-            })
-            .with_file_path("example/"),
-        )
-    }
-
     #[test]
     fn cant_read_file() {
         snap_diagnostic(


Test patch: