File tree Expand file tree Collapse file tree 4 files changed +251
-345
lines changed Expand file tree Collapse file tree 4 files changed +251
-345
lines changed Original file line number Diff line number Diff line change @@ -38,13 +38,13 @@ pub fn create_reporter() -> anyhow::Result<Box<dyn Reporter>> {
3838 std:: env:: var ( KEY_DESTINATION )
3939 . with_context ( || format ! ( "${} is missing from the environment" , KEY_DESTINATION ) )
4040 // Create a new reporter
41- . and_then ( tcp:: ReporterOnTcp :: new) ?;
41+ . map ( tcp:: ReporterOnTcp :: new) ?;
4242 Ok ( Box :: new ( reporter) )
4343}
4444
45- pub fn create_reporter_on_tcp ( address : & str ) -> anyhow :: Result < Box < dyn Reporter > > {
46- let reporter = tcp:: ReporterOnTcp :: new ( address. to_string ( ) ) ? ;
47- Ok ( Box :: new ( reporter) )
45+ pub fn create_reporter_on_tcp ( address : & str ) -> Box < dyn Reporter > {
46+ let reporter = tcp:: ReporterOnTcp :: new ( address. to_string ( ) ) ;
47+ Box :: new ( reporter)
4848}
4949
5050/// Represents the remote sink of supervised process events.
Original file line number Diff line number Diff line change @@ -135,9 +135,8 @@ impl ReporterOnTcp {
135135 ///
136136 /// It does not open the TCP connection yet. Stores the destination
137137 /// address and creates a unique reporter id.
138- pub fn new ( destination : String ) -> Result < Self , anyhow:: Error > {
139- let result = ReporterOnTcp { destination } ;
140- Ok ( result)
138+ pub fn new ( destination : String ) -> Self {
139+ ReporterOnTcp { destination }
141140 }
142141}
143142
@@ -192,7 +191,7 @@ mod tests {
192191 #[ test]
193192 fn tcp_reporter_and_collectors_work ( ) {
194193 let collector = CollectorOnTcp :: create ( ) . unwrap ( ) ;
195- let reporter = ReporterOnTcp :: new ( collector. address ( ) ) . unwrap ( ) ;
194+ let reporter = ReporterOnTcp :: new ( collector. address ( ) ) ;
196195
197196 // Create wrapper to share the collector across threads.
198197 let thread_collector = Arc :: new ( collector) ;
Original file line number Diff line number Diff line change @@ -18,8 +18,9 @@ crate-type = ["rlib", "cdylib"]
1818[dependencies ]
1919bear = { path = " ../bear" }
2020thiserror.workspace = true
21- anyhow.workspace = true
2221log.workspace = true
22+ env_logger.workspace = true
23+ ctor = { version = " 0.4" }
2324
2425[target .'cfg(target_os = "linux")' .dependencies ]
2526libc.workspace = true
You can’t perform that action at this time.
0 commit comments