From ec1a5a25c76350539f46b9da6a9d7a71f5d6ec80 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Fri, 15 Dec 2023 12:02:53 +1100 Subject: [PATCH 1/2] CONTRIBUTING: Remove stale links These sections have been removed but still have links in the index. --- CONTRIBUTING.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2e0da229..14cb8806 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,8 +18,6 @@ changes to this document in a pull request. * [Peer review](#peer-review) * [Repository maintainers](#repository-maintainers) - [Coding conventions](#coding-conventions) - * [Formatting](#formatting) - * [MSRV](#msrv) * [Naming conventions](#naming-conventions) * [Upgrading dependencies](#upgrading-dependencies) * [Unsafe code](#unsafe-code) From cb42c74f58b65057f2637413c27bd84bfc16173c Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Tue, 21 Nov 2023 13:39:25 +1100 Subject: [PATCH 2/2] policy: Add section on standard set of derives We can have a standard set of derives to make it easier for new devs to work out what to use and also to help us move towards a uniform set in preparation for crate stabilization. Mention the new `ordered` crate. --- CONTRIBUTING.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 14cb8806..7bd8eb3e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -335,6 +335,27 @@ sure, feel free to ask. If we determine panicking is more practical it must be d panics that could theoretically occur because of bugs in our code must not be documented. +#### Derives + +We try to use standard set of derives if it makes sense: + +``` +#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] +enum Foo { + Bar, + Baz, +} +``` + +For types that do should not form a total or partial order, or that technically do but it does not +make sense to compare them, we use the `Ordered` trait from the +[`ordered`](https://crates.io/crates/ordered) crate. See `absolute::LockTime` for an example. + +For error types you likely want to use `#[derive(Debug, Clone, PartialEq, Eq)]`. + +See [Errors](#errors) section. + + #### Attributes - `#[track_caller]`: Used on functions that panic on invalid arguments