feat: use dyn
This commit is contained in:
@@ -17,8 +17,8 @@ impl CommandImpl {
|
|||||||
information!("Verbose count: {}", verbose_count);
|
information!("Verbose count: {}", verbose_count);
|
||||||
information!(r#"Print using command line:
|
information!(r#"Print using command line:
|
||||||
commit-msg usage"#);
|
commit-msg usage"#);
|
||||||
let a = CommitMsgCheckRegex::new_default();
|
let a = Box::new(CommitMsgCheckRegex::new_default()) as Box<dyn CommitMsgCheck>;
|
||||||
let b = CommitMsgCheckQuickJs::new_from_js(r##"
|
let b = Box::new(CommitMsgCheckQuickJs::new_from_js(r##"
|
||||||
function check(a) {
|
function check(a) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -26,7 +26,7 @@ commit-msg usage"#);
|
|||||||
function hint() {
|
function hint() {
|
||||||
return "hello";
|
return "hello";
|
||||||
}
|
}
|
||||||
"##).expect("err");
|
"##).expect("err")) as Box<dyn CommitMsgCheck>;
|
||||||
|
|
||||||
if !a.check("a") {
|
if !a.check("a") {
|
||||||
a.print_hint();
|
a.print_hint();
|
||||||
|
|||||||
Reference in New Issue
Block a user