summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2023-03-01 13:18:54 +0100
committerMatthias Beyer <mail@beyermatthias.de>2023-03-01 13:36:42 +0100
commit851fd6f22f875d9c4092df51b7cdbccb3361c319 (patch)
tree3f2ce84663d37e48e1f7493a8afc2755831f8b53
parent7694527492017e1dc22656c5598d8c0db0d9d693 (diff)
Fix clippy: Dont pass reference here
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--src/template/group_by_helper.rs2
-rw-r--r--tests/common.rs8
-rw-r--r--tests/generate_command.rs6
-rw-r--r--tests/new_command.rs16
-rw-r--r--tests/new_command_creates_default_header.rs4
-rw-r--r--tests/new_command_editor.rs4
-rw-r--r--tests/no_config_error.rs4
-rw-r--r--tests/release_command.rs16
-rw-r--r--tests/verify_metadata_command.rs6
9 files changed, 33 insertions, 33 deletions
diff --git a/src/template/group_by_helper.rs b/src/template/group_by_helper.rs
index 29d8b53..05e35fc 100644
--- a/src/template/group_by_helper.rs
+++ b/src/template/group_by_helper.rs
@@ -51,7 +51,7 @@ impl HelperDef for GroupByHelper {
.into_iter()
.group_by(|elt: &serde_json::Value| {
elt.get("header")
- .and_then(|hdr| hdr.get(&group_by_attr))
+ .and_then(|hdr| hdr.get(group_by_attr))
.cloned()
})
.into_iter()
diff --git a/tests/common.rs b/tests/common.rs
index be9d3fd..efebe17 100644
--- a/tests/common.rs
+++ b/tests/common.rs
@@ -2,7 +2,7 @@
pub fn init_git(temp_dir: &std::path::Path) {
if !std::process::Command::new("git")
- .args(&["init"])
+ .args(["init"])
.current_dir(temp_dir)
.status()
.unwrap()
@@ -14,7 +14,7 @@ pub fn init_git(temp_dir: &std::path::Path) {
pub fn init_cargo(temp_dir: &std::path::Path, name: &str) {
if !std::process::Command::new("cargo")
- .args(&["init", "--bin", "--name", name])
+ .args(["init", "--bin", "--name", name])
.current_dir(temp_dir)
.status()
.unwrap()
@@ -27,8 +27,8 @@ pub fn init_cargo(temp_dir: &std::path::Path, name: &str) {
pub fn init_cargo_changelog(temp_dir: &std::path::Path) {
assert_cmd::Command::cargo_bin("cargo-changelog")
.unwrap()
- .args(&["init"])
- .current_dir(&temp_dir)
+ .args(["init"])
+ .current_dir(temp_dir)
.assert()
.success();
}
diff --git a/tests/generate_command.rs b/tests/generate_command.rs
index e8f1608..6ebc936 100644
--- a/tests/generate_command.rs
+++ b/tests/generate_command.rs
@@ -19,7 +19,7 @@ fn generate_command_creates_new_directory() {
// call `cargo-changelog generate`
Command::cargo_bin("cargo-changelog")
.unwrap()
- .args(&["generate", "minor"])
+ .args(["generate", "minor"])
.current_dir(&temp_dir)
.assert()
.success();
@@ -38,7 +38,7 @@ fn generate_command_moves_from_unreleased_dir() {
self::common::init_cargo_changelog(temp_dir.path());
self::common::cargo_changelog_new(temp_dir.path())
- .args(&[
+ .args([
"--format=yaml",
"--set",
"issue=123",
@@ -77,7 +77,7 @@ fn generate_command_moves_from_unreleased_dir() {
// call `cargo-changelog generate`
Command::cargo_bin("cargo-changelog")
.unwrap()
- .args(&["generate", "minor"])
+ .args(["generate", "minor"])
.current_dir(&temp_dir)
.assert()
.success();
diff --git a/tests/new_command.rs b/tests/new_command.rs
index 561ce24..68de468 100644
--- a/tests/new_command.rs
+++ b/tests/new_command.rs
@@ -9,7 +9,7 @@ fn new_command_creates_yaml_file() {
self::common::init_cargo_changelog(temp_dir.path());
self::common::cargo_changelog_new(temp_dir.path())
- .args(&[
+ .args([
"--format=yaml",
"--set",
"issue=123",
@@ -113,7 +113,7 @@ fn new_command_with_text_creates_yaml_with_text_from_stdin() {
drop(file); // make sure we close the handle
self::common::cargo_changelog_new(temp_dir.path())
- .args(&[
+ .args([
"--format=yaml",
"--set",
"issue=123",
@@ -129,7 +129,7 @@ fn new_command_with_text_creates_yaml_with_text_from_stdin() {
.success();
}
- let fragment_file = std::fs::read_dir(&temp_dir.path().join(".changelogs").join("unreleased"))
+ let fragment_file = std::fs::read_dir(temp_dir.path().join(".changelogs").join("unreleased"))
.unwrap()
.into_iter()
.find(|rde| match rde {
@@ -173,7 +173,7 @@ fn new_command_with_text_creates_yaml_with_text_from_file() {
drop(file); // make sure we close the handle
self::common::cargo_changelog_new(temp_dir.path())
- .args(&[
+ .args([
"--format=yaml",
"--set",
"issue=123",
@@ -191,7 +191,7 @@ fn new_command_with_text_creates_yaml_with_text_from_file() {
.success();
}
- let fragment_file = std::fs::read_dir(&temp_dir.path().join(".changelogs").join("unreleased"))
+ let fragment_file = std::fs::read_dir(temp_dir.path().join(".changelogs").join("unreleased"))
.unwrap()
.into_iter()
.find(|rde| match rde {
@@ -220,7 +220,7 @@ fn new_command_creates_toml_header() {
self::common::init_cargo_changelog(temp_dir.path());
self::common::cargo_changelog_new(temp_dir.path())
- .args(&[
+ .args([
"--format=toml",
"--set",
"issue=123",
@@ -234,7 +234,7 @@ fn new_command_creates_toml_header() {
let unreleased_dir = temp_dir.path().join(".changelogs").join("unreleased");
- let new_fragment_file = std::fs::read_dir(&unreleased_dir)
+ let new_fragment_file = std::fs::read_dir(unreleased_dir)
.unwrap()
.into_iter()
.find(|rde| match rde {
@@ -283,7 +283,7 @@ fn new_command_cannot_create_nonexistent_oneof() {
}
self::common::cargo_changelog_new(temp_dir.path())
- .args(&[
+ .args([
"--format=toml",
"--set",
"issue=123",
diff --git a/tests/new_command_creates_default_header.rs b/tests/new_command_creates_default_header.rs
index c083d66..632a37e 100644
--- a/tests/new_command_creates_default_header.rs
+++ b/tests/new_command_creates_default_header.rs
@@ -29,7 +29,7 @@ fn new_command_creates_default_header() {
}
self::common::cargo_changelog_new(temp_dir.path())
- .args(&[
+ .args([
"--format=yaml",
"--set",
"issue=123",
@@ -44,7 +44,7 @@ fn new_command_creates_default_header() {
.success();
let unreleased_dir = temp_dir.path().join(".changelogs").join("unreleased");
- let fragment = std::fs::read_dir(&unreleased_dir)
+ let fragment = std::fs::read_dir(unreleased_dir)
.unwrap()
.into_iter()
.find(|rde| match rde {
diff --git a/tests/new_command_editor.rs b/tests/new_command_editor.rs
index 77db8f7..a126b75 100644
--- a/tests/new_command_editor.rs
+++ b/tests/new_command_editor.rs
@@ -64,7 +64,7 @@ fn new_command_opens_editor() {
]
.into_iter(),
)
- .args(&[
+ .args([
"new",
"--interactive=false",
"--format=yaml",
@@ -83,7 +83,7 @@ fn new_command_opens_editor() {
drop(script_temp_dir);
let unreleased_dir = temp_dir.path().join(".changelogs").join("unreleased");
- let files = std::fs::read_dir(&unreleased_dir)
+ let files = std::fs::read_dir(unreleased_dir)
.unwrap()
.into_iter()
.filter_map(|direntry| match direntry {
diff --git a/tests/no_config_error.rs b/tests/no_config_error.rs
index 373a92e..dade6b3 100644
--- a/tests/no_config_error.rs
+++ b/tests/no_config_error.rs
@@ -9,7 +9,7 @@ fn no_configuration_file_errors() {
Command::cargo_bin("cargo-changelog")
.unwrap()
- .args(&["release"]) // we need some subcommand, otherwise nothing happens
+ .args(["release"]) // we need some subcommand, otherwise nothing happens
.current_dir(&temp_dir)
.assert()
.failure();
@@ -22,7 +22,7 @@ fn no_configuration_file_errors_with_error_message() {
Command::cargo_bin("cargo-changelog")
.unwrap()
- .args(&["release"]) // we need some subcommand, otherwise nothing happens
+ .args(["release"]) // we need some subcommand, otherwise nothing happens
.current_dir(&temp_dir)
.assert()
.stderr(predicates::str::contains(
diff --git a/tests/release_command.rs b/tests/release_command.rs
index 1715d34..e69a94b 100644
--- a/tests/release_command.rs
+++ b/tests/release_command.rs
@@ -12,7 +12,7 @@ fn release_command_works() {
self::common::init_cargo_changelog(temp_dir.path());
self::common::cargo_changelog_new(temp_dir.path())
- .args(&[
+ .args([
"--format=yaml",
"--set",
"issue=123",
@@ -26,7 +26,7 @@ fn release_command_works() {
Command::cargo_bin("cargo-changelog")
.unwrap()
- .args(&["generate", "minor"])
+ .args(["generate", "minor"])
.current_dir(&temp_dir)
.assert()
.success();
@@ -34,7 +34,7 @@ fn release_command_works() {
// call `cargo-changelog generate`
Command::cargo_bin("cargo-changelog")
.unwrap()
- .args(&["release"])
+ .args(["release"])
.current_dir(&temp_dir)
.assert()
.success();
@@ -57,7 +57,7 @@ fn release_command_works_for_alpha_release() {
self::common::init_cargo_changelog(temp_dir.path());
self::common::cargo_changelog_new(temp_dir.path())
- .args(&[
+ .args([
"--format=yaml",
"--set",
"issue=123",
@@ -71,7 +71,7 @@ fn release_command_works_for_alpha_release() {
let unreleased_dir = temp_dir.path().join(".changelogs").join("unreleased");
- let new_fragment_file_path = std::fs::read_dir(&unreleased_dir)
+ let new_fragment_file_path = std::fs::read_dir(unreleased_dir)
.unwrap()
.into_iter()
.find(|rde| match rde {
@@ -95,7 +95,7 @@ fn release_command_works_for_alpha_release() {
Command::cargo_bin("cargo-changelog")
.unwrap()
- .args(&["generate", "custom", "0.1.0-alpha.1"])
+ .args(["generate", "custom", "0.1.0-alpha.1"])
.current_dir(&temp_dir)
.assert()
.success();
@@ -103,7 +103,7 @@ fn release_command_works_for_alpha_release() {
// call `cargo-changelog generate`
Command::cargo_bin("cargo-changelog")
.unwrap()
- .args(&["release"])
+ .args(["release"])
.current_dir(&temp_dir)
.assert()
.success();
@@ -117,7 +117,7 @@ fn release_command_works_for_alpha_release() {
panic!("Changelog is not a file");
}
- let changelog = std::fs::read_to_string(&changelog_file_path).unwrap();
+ let changelog = std::fs::read_to_string(changelog_file_path).unwrap();
assert!(changelog.contains("0.1.0-alpha.1"));
assert!(changelog.contains("test text"));
}
diff --git a/tests/verify_metadata_command.rs b/tests/verify_metadata_command.rs
index 1889800..0c63842 100644
--- a/tests/verify_metadata_command.rs
+++ b/tests/verify_metadata_command.rs
@@ -10,7 +10,7 @@ fn verify_metadata_command_succeeds_with_no_changelogs() {
Command::cargo_bin("cargo-changelog")
.unwrap()
- .args(&["verify-metadata"])
+ .args(["verify-metadata"])
.current_dir(&temp_dir)
.assert()
.success();
@@ -23,7 +23,7 @@ fn verify_metadata_command_succeeds_with_empty_changelog() {
self::common::init_cargo_changelog(temp_dir.path());
self::common::cargo_changelog_new(temp_dir.path())
- .args(&[
+ .args([
"--format=yaml",
"--set",
"issue=123",
@@ -37,7 +37,7 @@ fn verify_metadata_command_succeeds_with_empty_changelog() {
Command::cargo_bin("cargo-changelog")
.unwrap()
- .args(&["verify-metadata"])
+ .args(["verify-metadata"])
.current_dir(&temp_dir)
.assert()
.success();