فهرست منبع

Remove some tabs which snuck in somehow

Benjamin Sago 4 سال پیش
والد
کامیت
53e213389f
2فایلهای تغییر یافته به همراه33 افزوده شده و 33 حذف شده
  1. 2 2
      Justfile
  2. 31 31
      src/output.rs

+ 2 - 2
Justfile

@@ -57,11 +57,11 @@ export DOG_DEBUG := ""
 
 # prints out the data that caused crashes during fuzzing as hexadecimal
 @fuzz-hex:
-	for crash in dns/fuzz/artifacts/fuzz_parsing/crash-*; do echo; echo $crash; hexyl $crash; done
+    for crash in dns/fuzz/artifacts/fuzz_parsing/crash-*; do echo; echo $crash; hexyl $crash; done
 
 # removes fuzz log files
 @fuzz-clean:
-	rm dns/fuzz/fuzz-*.log
+    rm dns/fuzz/fuzz-*.log
 
 
 # lints the code

+ 31 - 31
src/output.rs

@@ -152,21 +152,21 @@ impl OutputFormat {
     /// Print an error that’s ocurred while sending or receiving DNS packets
     /// to standard error.
     pub fn print_error(self, error: TransportError) {
-    	match self {
-    		Self::Short(..) | Self::Text(..) => {
-    			eprintln!("Error [{}]: {}", erroneous_phase(&error), error_message(error));
-    		}
-
-    		Self::JSON => {
-    			let object = json!({
-    				"error": true,
-    				"error_phase": erroneous_phase(&error),
-    				"error_message": error_message(error),
-    			});
-
-    			eprintln!("{}", object);
-    		}
-    	}
+        match self {
+            Self::Short(..) | Self::Text(..) => {
+                eprintln!("Error [{}]: {}", erroneous_phase(&error), error_message(error));
+            }
+
+            Self::JSON => {
+                let object = json!({
+                    "error": true,
+                    "error_phase": erroneous_phase(&error),
+                    "error_message": error_message(error),
+                });
+
+                eprintln!("{}", object);
+            }
+        }
     }
 }
 
@@ -505,32 +505,32 @@ pub fn print_error_code(rcode: ErrorCode) {
 /// Returns the “phase” of operation where an error occurred. This gets shown
 /// to the user so they can debug what went wrong.
 fn erroneous_phase(error: &TransportError) -> &'static str {
-	match error {
-		TransportError::WireError(_)          => "protocol",
-		TransportError::NetworkError(_)       => "network",
+    match error {
+        TransportError::WireError(_)          => "protocol",
+        TransportError::NetworkError(_)       => "network",
         #[cfg(feature="tls")]
-		TransportError::TlsError(_)           |
-		TransportError::TlsHandshakeError(_)  => "tls",
+        TransportError::TlsError(_)           |
+        TransportError::TlsHandshakeError(_)  => "tls",
         #[cfg(feature="https")]
-		TransportError::HttpError(_)          |
-		TransportError::WrongHttpStatus(_,_)  => "http",
-	}
+        TransportError::HttpError(_)          |
+        TransportError::WrongHttpStatus(_,_)  => "http",
+    }
 }
 
 /// Formats an error into its human-readable message.
 fn error_message(error: TransportError) -> String {
-	match error {
-		TransportError::WireError(e)          => wire_error_message(e),
-		TransportError::NetworkError(e)       => e.to_string(),
+    match error {
+        TransportError::WireError(e)          => wire_error_message(e),
+        TransportError::NetworkError(e)       => e.to_string(),
         #[cfg(feature="tls")]
-		TransportError::TlsError(e)           => e.to_string(),
+        TransportError::TlsError(e)           => e.to_string(),
         #[cfg(feature="tls")]
-		TransportError::TlsHandshakeError(e)  => e.to_string(),
+        TransportError::TlsHandshakeError(e)  => e.to_string(),
         #[cfg(feature="https")]
-		TransportError::HttpError(e)          => e.to_string(),
+        TransportError::HttpError(e)          => e.to_string(),
         #[cfg(feature="https")]
-		TransportError::WrongHttpStatus(t,r)  => format!("Nameserver returned HTTP {} ({})", t, r.unwrap_or_else(|| "No reason".into()))
-	}
+        TransportError::WrongHttpStatus(t,r)  => format!("Nameserver returned HTTP {} ({})", t, r.unwrap_or_else(|| "No reason".into()))
+    }
 }
 
 /// Formats a wire error into its human-readable message, describing what was