Skip to content

Commit 3e3e6b1

Browse files
author
Andrew
committed
Fixed clippy erros
1 parent d4939b1 commit 3e3e6b1

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

dsc_lib/src/dscerror.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ pub struct StreamMessage {
8484
pub resource_path: String
8585
}
8686

87+
impl Default for StreamMessage {
88+
fn default() -> Self {
89+
Self::new()
90+
}
91+
}
92+
8793
impl StreamMessage {
8894
pub fn new() -> Self {
8995
Self {
@@ -95,22 +101,22 @@ impl StreamMessage {
95101
}
96102
}
97103
pub fn new_error(message: String, resource_type_name: Option<String>, resource_path: Option<String>) -> StreamMessage {
98-
return StreamMessage {
104+
StreamMessage {
99105
message: message.clone(),
100106
message_type: StreamMessageType::Error,
101107
time: Local::now(),
102108
resource_type_name: resource_type_name.unwrap_or("None".to_string()),
103109
resource_path: resource_path.unwrap_or("None".to_string())
104-
};
110+
}
105111
}
106112
pub fn new_warning(message: String, resource_type_name: Option<String>, resource_path: Option<String>) -> StreamMessage {
107-
return StreamMessage {
113+
StreamMessage {
108114
message: message.clone(),
109115
message_type: StreamMessageType::Warning,
110116
time: Local::now(),
111117
resource_type_name: resource_type_name.unwrap_or("None".to_string()).clone(),
112118
resource_path: resource_path.unwrap_or("None".to_string()).clone()
113-
};
119+
}
114120
}
115121
pub fn print(&self, error_format:&StreamMessageType, warning_format:&StreamMessageType) -> Result<(), DscError>{
116122
if self.message_type == StreamMessageType::Error

0 commit comments

Comments
 (0)