From 98d6ab386516f57e7afe8679fc308cf549bf3aa6 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 29 Feb 2024 09:52:00 +1100 Subject: [PATCH] policy: Mention format of error variants An error enum type should not use an `Error` prefix for its variants, mention as such in the policy docs. --- CONTRIBUTING.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1b426e040..600c95e71 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -314,8 +314,9 @@ More specifically an error should - have private fields unless we are very confident they won't change. - derive `Debug, Clone, PartialEq, Eq` (and `Copy` iff not `non_exhaustive`). - implement Display using `write_err!()` macro if a variant contains an inner error source. -- have `Error` suffix -- call `internals::impl_from_infallible! +- have `Error` suffix on error types (structs and enums). +- not have `Error` suffix on enum variants. +- call `internals::impl_from_infallible!`. - implement `std::error::Error` if they are public (feature gated on "std"). ```rust