diff --git a/src/lints/function_const_removed.ron b/src/lints/function_const_removed.ron index cd9a1d02..63175e7d 100644 --- a/src/lints/function_const_removed.ron +++ b/src/lints/function_const_removed.ron @@ -48,4 +48,9 @@ SemverQuery( }, error_message: "A publicly-visible function is no longer `const` and can no longer be used in a `const` context.", per_result_error_template: Some("function {{join \"::\" path}} in file {{span_filename}}:{{span_begin_line}}"), + witness: ( + hint_template: r#"const fn witness() { + {{join "::" path}}(...); +}"#, + ), ) diff --git a/test_outputs/witnesses/function_const_removed.snap b/test_outputs/witnesses/function_const_removed.snap new file mode 100644 index 00000000..bddbed70 --- /dev/null +++ b/test_outputs/witnesses/function_const_removed.snap @@ -0,0 +1,12 @@ +--- +source: src/query.rs +description: "Lint `function_const_removed` did not have the expected witness output.\nSee https://github.com/obi1kenobi/cargo-semver-checks/blob/main/CONTRIBUTING.md#testing-witnesses\nfor more information." +expression: "&actual_witnesses" +--- +[["./test_crates/function_const_removed/"]] +filename = 'src/lib.rs' +begin_line = 1 +hint = ''' +const fn witness() { + function_const_removed::add(...); +}'''