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

fix(cli): clippy errors in tests #330

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ pub struct Message {
/// Description part of the commit message.
pub description: Option<String>,

#[allow(dead_code)]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recently added a rule for footers, so this is not dead anymore: #327

Could you remove it from this field?
Thank you!

KeisukeYamashita marked this conversation as resolved.
Show resolved Hide resolved
/// Footers part of the commit message.
pub footers: Option<HashMap<String, String>>,

#[allow(dead_code)]
/// Raw commit message (or any input from stdin) including the body and footers.
pub raw: String,

Expand Down
18 changes: 12 additions & 6 deletions src/rule/description_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ mod tests {

#[test]
fn test_invalid_description_format() {
let mut rule = DescriptionFormat::default();
rule.format = Some(r"^[a-z].*".to_string());
let rule = DescriptionFormat {
format: Some(r"^[a-z].*".to_string()),
..Default::default()
};

let message = Message {
body: None,
Expand All @@ -96,8 +98,10 @@ mod tests {

#[test]
fn test_valid_description_format() {
let mut rule = DescriptionFormat::default();
rule.format = Some(r"^[a-z].*".to_string());
let rule = DescriptionFormat {
format: Some(r"^[a-z].*".to_string()),
..Default::default()
};

let message = Message {
body: None,
Expand All @@ -120,8 +124,10 @@ mod tests {

#[test]
fn test_invalid_regex() {
let mut rule = DescriptionFormat::default();
rule.format = Some(r"(".to_string());
let rule = DescriptionFormat {
format: Some(r"(".to_string()),
..Default::default()
};

let message = Message {
body: None,
Expand Down
24 changes: 16 additions & 8 deletions src/rule/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,10 @@ mod tests {
use super::*;
#[test]
fn test_empty_scope() {
let mut rule = Scope::default();
rule.options = vec!["api".to_string(), "web".to_string()];
let rule = Scope {
options: vec!["api".to_string(), "web".to_string()],
..Default::default()
};

let message = Message {
body: None,
Expand All @@ -164,8 +166,10 @@ mod tests {

#[test]
fn test_none_scope() {
let mut rule = Scope::default();
rule.options = vec!["api".to_string(), "web".to_string()];
let rule = Scope {
options: vec!["api".to_string(), "web".to_string()],
..Default::default()
};

let message = Message {
body: None,
Expand All @@ -188,8 +192,10 @@ mod tests {

#[test]
fn test_valid_scope() {
let mut rule = Scope::default();
rule.options = vec!["api".to_string(), "web".to_string()];
let rule = Scope {
options: vec!["api".to_string(), "web".to_string()],
..Default::default()
};

let message = Message {
body: None,
Expand All @@ -206,8 +212,10 @@ mod tests {

#[test]
fn test_invalid_scope() {
let mut rule = Scope::default();
rule.options = vec!["api".to_string(), "web".to_string()];
let rule = Scope {
options: vec!["api".to_string(), "web".to_string()],
..Default::default()
};

let message = Message {
body: None,
Expand Down
18 changes: 12 additions & 6 deletions src/rule/scope_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ mod tests {

#[test]
fn test_invalid_description_format() {
let mut rule = ScopeFormat::default();
rule.format = Some(r"^[a-z].*".to_string());
let rule = ScopeFormat {
format: Some(r"^[a-z].*".to_string()),
..Default::default()
};

let message = Message {
body: None,
Expand All @@ -96,8 +98,10 @@ mod tests {

#[test]
fn test_valid_description_format() {
let mut rule = ScopeFormat::default();
rule.format = Some(r"^[a-z].*".to_string());
let rule = ScopeFormat {
format: Some(r"^[a-z].*".to_string()),
..Default::default()
};

let message = Message {
body: None,
Expand All @@ -120,8 +124,10 @@ mod tests {

#[test]
fn test_invalid_regex() {
let mut rule = ScopeFormat::default();
rule.format = Some(r"(".to_string());
let rule = ScopeFormat {
format: Some(r"(".to_string()),
..Default::default()
};

let message = Message {
body: None,
Expand Down
24 changes: 16 additions & 8 deletions src/rule/type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,10 @@ mod tests {
use super::*;
#[test]
fn test_empty_type() {
let mut rule = Type::default();
rule.options = vec!["feat".to_string(), "chore".to_string()];
let rule = Type {
options: vec!["feat".to_string(), "chore".to_string()],
..Default::default()
};

let message = Message {
body: None,
Expand All @@ -163,8 +165,10 @@ mod tests {

#[test]
fn test_none_type() {
let mut rule = Type::default();
rule.options = vec!["feat".to_string(), "chore".to_string()];
let rule = Type {
options: vec!["feat".to_string(), "chore".to_string()],
..Default::default()
};

let message = Message {
body: None,
Expand All @@ -187,8 +191,10 @@ mod tests {

#[test]
fn test_valid_type() {
let mut rule = Type::default();
rule.options = vec!["feat".to_string(), "chore".to_string()];
let rule = Type {
options: vec!["feat".to_string(), "chore".to_string()],
..Default::default()
};

let message = Message {
body: None,
Expand All @@ -205,8 +211,10 @@ mod tests {

#[test]
fn test_invalid_type() {
let mut rule = Type::default();
rule.options = vec!["feat".to_string(), "chore".to_string()];
let rule = Type {
options: vec!["feat".to_string(), "chore".to_string()],
..Default::default()
};

let message = Message {
body: None,
Expand Down
18 changes: 12 additions & 6 deletions src/rule/type_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ mod tests {

#[test]
fn test_invalid_description_format() {
let mut rule = TypeFormat::default();
rule.format = Some(r"^[a-z].*".to_string());
let rule = TypeFormat {
format: Some(r"^[a-z].*".to_string()),
..Default::default()
};

let message = Message {
body: None,
Expand All @@ -96,8 +98,10 @@ mod tests {

#[test]
fn test_valid_description_format() {
let mut rule = TypeFormat::default();
rule.format = Some(r"^[a-z].*".to_string());
let rule = TypeFormat {
format: Some(r"^[a-z].*".to_string()),
..Default::default()
};

let message = Message {
body: None,
Expand All @@ -120,8 +124,10 @@ mod tests {

#[test]
fn test_invalid_regex() {
let mut rule = TypeFormat::default();
rule.format = Some(r"(".to_string());
let rule = TypeFormat {
format: Some(r"(".to_string()),
..Default::default()
};

let message = Message {
body: None,
Expand Down
Loading