From 7b51216e24c414dcc2d378d9c437776f9542baae Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 22 Apr 2024 17:01:09 -0500 Subject: [PATCH] refactor: Switch from Into to IntoData Prep for removing Into Cherry pick 8daebd32ec2734fdb42e84f55bed7048b89803c3 (#292) --- crates/snapbox/src/cmd.rs | 4 ++-- crates/trycmd/src/runner.rs | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/crates/snapbox/src/cmd.rs b/crates/snapbox/src/cmd.rs index 2331ca15..f13471a2 100644 --- a/crates/snapbox/src/cmd.rs +++ b/crates/snapbox/src/cmd.rs @@ -702,7 +702,7 @@ impl OutputAssert { #[track_caller] fn stdout_eq_inner(self, expected: crate::Data) -> Self { - let actual = crate::Data::from(self.output.stdout.as_slice()); + let actual = self.output.stdout.as_slice().into_data(); if let Err(err) = self.config.try_eq(Some(&"stdout"), actual, expected) { err.panic(); } @@ -824,7 +824,7 @@ impl OutputAssert { #[track_caller] fn stderr_eq_inner(self, expected: crate::Data) -> Self { - let actual = crate::Data::from(self.output.stderr.as_slice()); + let actual = self.output.stderr.as_slice().into_data(); if let Err(err) = self.config.try_eq(Some(&"stderr"), actual, expected) { err.panic(); } diff --git a/crates/trycmd/src/runner.rs b/crates/trycmd/src/runner.rs index 0d405fd4..96159164 100644 --- a/crates/trycmd/src/runner.rs +++ b/crates/trycmd/src/runner.rs @@ -15,6 +15,7 @@ use rayon::prelude::*; use snapbox::data::DataFormat; use snapbox::dir::FileType; use snapbox::filter::{Filter as _, FilterNewlines, FilterPaths, FilterRedactions}; +use snapbox::IntoData; #[derive(Debug)] pub(crate) struct Runner { @@ -584,12 +585,12 @@ impl Output { self.spawn.status = SpawnStatus::Ok; self.stdout = Some(Stream { stream: Stdio::Stdout, - content: output.stdout.into(), + content: output.stdout.into_data(), status: StreamStatus::Ok, }); self.stderr = Some(Stream { stream: Stdio::Stderr, - content: output.stderr.into(), + content: output.stderr.into_data(), status: StreamStatus::Ok, }); self