@@ -472,6 +472,7 @@ pub mod test_support {
472472 /// ```rust,ignore
473473 /// let test_output = TestUserOutput::new(VerbosityLevel::Normal);
474474 /// ```
475+ #[ must_use]
475476 pub fn new ( verbosity : VerbosityLevel ) -> Self {
476477 let stdout_buffer = Arc :: new ( Mutex :: new ( Vec :: new ( ) ) ) ;
477478 let stderr_buffer = Arc :: new ( Mutex :: new ( Vec :: new ( ) ) ) ;
@@ -499,6 +500,7 @@ pub mod test_support {
499500 /// let output = TestUserOutput::wrapped(VerbosityLevel::Normal);
500501 /// // Use with APIs that expect Arc<Mutex<UserOutput>>
501502 /// ```
503+ #[ must_use]
502504 pub fn wrapped ( verbosity : VerbosityLevel ) -> Arc < Mutex < UserOutput > > {
503505 let test_output = Self :: new ( verbosity) ;
504506 Arc :: new ( Mutex :: new ( test_output. output ) )
@@ -517,8 +519,15 @@ pub mod test_support {
517519 /// // Use `wrapped` with APIs that expect Arc<Mutex<UserOutput>>
518520 /// // Use buffers to assert on output content
519521 /// ```
522+ #[ must_use]
520523 #[ allow( clippy:: type_complexity) ]
521- pub fn into_wrapped ( self ) -> ( Arc < Mutex < UserOutput > > , Arc < Mutex < Vec < u8 > > > , Arc < Mutex < Vec < u8 > > > ) {
524+ pub fn into_wrapped (
525+ self ,
526+ ) -> (
527+ Arc < Mutex < UserOutput > > ,
528+ Arc < Mutex < Vec < u8 > > > ,
529+ Arc < Mutex < Vec < u8 > > > ,
530+ ) {
522531 let stdout_buf = Arc :: clone ( & self . stdout_buffer ) ;
523532 let stderr_buf = Arc :: clone ( & self . stderr_buffer ) ;
524533 ( Arc :: new ( Mutex :: new ( self . output ) ) , stdout_buf, stderr_buf)
@@ -533,6 +542,12 @@ pub mod test_support {
533542 /// test_output.output.result("Done");
534543 /// assert_eq!(test_output.stdout(), "Done\n");
535544 /// ```
545+ ///
546+ /// # Panics
547+ ///
548+ /// Panics if the mutex is poisoned or if the buffer contains invalid UTF-8.
549+ /// These conditions indicate a test bug and should never occur in practice.
550+ #[ must_use]
536551 pub fn stdout ( & self ) -> String {
537552 String :: from_utf8 ( self . stdout_buffer . lock ( ) . unwrap ( ) . clone ( ) )
538553 . expect ( "stdout should be valid UTF-8" )
@@ -547,6 +562,12 @@ pub mod test_support {
547562 /// test_output.output.progress("Working...");
548563 /// assert_eq!(test_output.stderr(), "⏳ Working...\n");
549564 /// ```
565+ ///
566+ /// # Panics
567+ ///
568+ /// Panics if the mutex is poisoned or if the buffer contains invalid UTF-8.
569+ /// These conditions indicate a test bug and should never occur in practice.
570+ #[ must_use]
550571 pub fn stderr ( & self ) -> String {
551572 String :: from_utf8 ( self . stderr_buffer . lock ( ) . unwrap ( ) . clone ( ) )
552573 . expect ( "stderr should be valid UTF-8" )
@@ -564,6 +585,7 @@ pub mod test_support {
564585 /// assert_eq!(stdout, "Done\n");
565586 /// assert_eq!(stderr, "⏳ Working...\n");
566587 /// ```
588+ #[ must_use]
567589 #[ allow( dead_code) ]
568590 pub fn output_pair ( & self ) -> ( String , String ) {
569591 ( self . stdout ( ) , self . stderr ( ) )
@@ -582,6 +604,11 @@ pub mod test_support {
582604 /// test_output.output.progress("Step 2");
583605 /// assert_eq!(test_output.stderr(), "⏳ Step 2\n");
584606 /// ```
607+ ///
608+ /// # Panics
609+ ///
610+ /// Panics if the mutex is poisoned. This indicates a test bug and should
611+ /// never occur in practice.
585612 #[ allow( dead_code) ]
586613 pub fn clear ( & mut self ) {
587614 self . stdout_buffer . lock ( ) . unwrap ( ) . clear ( ) ;
@@ -790,7 +817,9 @@ mod tests {
790817 fn it_should_not_write_steps_at_quiet_level ( ) {
791818 let mut test_output = test_support:: TestUserOutput :: new ( VerbosityLevel :: Quiet ) ;
792819
793- test_output. output . steps ( "Next steps:" , & [ "Step 1" , "Step 2" ] ) ;
820+ test_output
821+ . output
822+ . steps ( "Next steps:" , & [ "Step 1" , "Step 2" ] ) ;
794823
795824 // Verify no output at Quiet level
796825 assert_eq ! ( test_output. stderr( ) , "" ) ;
@@ -822,7 +851,9 @@ mod tests {
822851 fn it_should_not_write_info_block_at_quiet_level ( ) {
823852 let mut test_output = test_support:: TestUserOutput :: new ( VerbosityLevel :: Quiet ) ;
824853
825- test_output. output . info_block ( "Info:" , & [ "Line 1" , "Line 2" ] ) ;
854+ test_output
855+ . output
856+ . info_block ( "Info:" , & [ "Line 1" , "Line 2" ] ) ;
826857
827858 // Verify no output at Quiet level
828859 assert_eq ! ( test_output. stderr( ) , "" ) ;
0 commit comments