From 186e2a35fb33105da9d8504eb1e2fc2935acb0e7 Mon Sep 17 00:00:00 2001 From: Joshua Batty Date: Wed, 15 Nov 2023 13:47:38 +1100 Subject: [PATCH] fix clippy errros --- forc-plugins/forc-doc/src/tests/expects/impl_trait/mod.rs | 2 +- forc-plugins/forc-doc/src/tests/expects/mod.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/forc-plugins/forc-doc/src/tests/expects/impl_trait/mod.rs b/forc-plugins/forc-doc/src/tests/expects/impl_trait/mod.rs index a9f639c32e3..ced094f43b5 100644 --- a/forc-plugins/forc-doc/src/tests/expects/impl_trait/mod.rs +++ b/forc-plugins/forc-doc/src/tests/expects/impl_trait/mod.rs @@ -133,7 +133,7 @@ fn assert_file_tree(doc_dir_name: &str, project_name: &str, expected_files: Vec< let doc_root = format!("{}/{}/out/{}", DATA_DIR, project_name, doc_dir_name).into(); let expected = expected_files .iter() - .map(|path| PathBuf::from(path)) + .map(PathBuf::from) .collect::>(); let files = get_relative_file_paths_set(doc_root); assert_eq!(files, expected); diff --git a/forc-plugins/forc-doc/src/tests/expects/mod.rs b/forc-plugins/forc-doc/src/tests/expects/mod.rs index abd380ce7c0..711d3bbba65 100644 --- a/forc-plugins/forc-doc/src/tests/expects/mod.rs +++ b/forc-plugins/forc-doc/src/tests/expects/mod.rs @@ -1,14 +1,14 @@ #![cfg(test)] use crate::cli::Command; use expect_test::Expect; -use std::path::PathBuf; +use std::path::{Path, PathBuf}; mod impl_trait; -pub(crate) fn check_file(doc_path: &PathBuf, path_to_file: &PathBuf, expect: &Expect) { +pub(crate) fn check_file(doc_path: &Path, path_to_file: &PathBuf, expect: &Expect) { let path = doc_path.join(path_to_file); - let actual = - std::fs::read_to_string(path.clone()).expect(&format!("failed to read file: {:?}", path)); + let actual = std::fs::read_to_string(path.clone()) + .unwrap_or_else(|_| panic!("failed to read file: {:?}", path)); expect.assert_eq(&actual) }