Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clippy changes to cargo-insta #382

Merged
merged 1 commit into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion cargo-insta/src/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl Package {
&self.version
}

pub fn find_snapshot_roots<'a>(&self) -> Vec<PathBuf> {
pub fn find_snapshot_roots(&self) -> Vec<PathBuf> {
let mut roots = Vec::new();

// the manifest path's parent is always a snapshot container. For
Expand Down
10 changes: 6 additions & 4 deletions cargo-insta/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::borrow::Cow;
use std::borrow::{Borrow, Cow};
use std::collections::HashSet;
use std::error::Error;
use std::path::{Path, PathBuf};
Expand Down Expand Up @@ -352,7 +352,9 @@ fn handle_target_args(target_args: &TargetArgs) -> Result<LocationInfo<'_>, Box<
target_args.manifest_path.as_ref(),
) {
(Some(_), Some(_)) => {
return Err(err_msg("both manifest-path and workspace-root provided.".to_string()))
return Err(err_msg(
"both manifest-path and workspace-root provided.".to_string(),
))
}
(None, Some(manifest)) => (None, Some(Cow::Borrowed(manifest))),
(Some(root), manifest_path) => {
Expand Down Expand Up @@ -622,7 +624,7 @@ fn test_run(mut cmd: TestCommand, color: &str) -> Result<(), Box<dyn Error>> {

// handle unreferenced snapshots if we were instructed to do so
if let Some(ref path) = snapshot_ref_file {
handle_unreferenced_snapshots(path, &loc, unreferenced, cmd.package.as_deref())?;
handle_unreferenced_snapshots(path.borrow(), &loc, unreferenced, cmd.package.as_deref())?;
}

if cmd.review || cmd.accept {
Expand Down Expand Up @@ -660,7 +662,7 @@ fn test_run(mut cmd: TestCommand, color: &str) -> Result<(), Box<dyn Error>> {
}

fn handle_unreferenced_snapshots(
path: &Cow<Path>,
path: &Path,
loc: &LocationInfo<'_>,
unreferenced: UnreferencedSnapshots,
package: Option<&str>,
Expand Down