From b9e373a7363bef32394c154408b71935e3f66925 Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Wed, 20 Sep 2023 09:43:25 +0300 Subject: [PATCH] Add repo and crate metadata (#5) Add various pieces of crate-level and repo-level metadata, such as: - PR / issue templates - Contributing guidelines - Security policy - `html_root_url`s for crates - Crate usage snippets in readmes --- .github/ISSUE_TEMPLATE/bug_report.md | 39 ++++ .github/ISSUE_TEMPLATE/feature_request.md | 21 ++ .github/SECURITY.md | 74 ++++++ .github/pull_request_template.md | 20 ++ CONTRIBUTING.md | 42 ++++ Cargo.lock | 238 +++++++++++++++++++- Cargo.toml | 1 + crates/vise-exporter/Cargo.toml | 6 + crates/vise-exporter/README.md | 9 + crates/vise-exporter/src/lib.rs | 4 + crates/vise-exporter/tests/version_match.rs | 11 + crates/vise-macros/Cargo.toml | 3 + crates/vise-macros/src/lib.rs | 20 +- crates/vise-macros/src/metrics.rs | 4 +- crates/vise-macros/src/register.rs | 2 +- crates/vise-macros/tests/version_match.rs | 6 + crates/vise/Cargo.toml | 1 + crates/vise/README.md | 7 + crates/vise/src/lib.rs | 2 + crates/vise/tests/version_match.rs | 11 + deny.toml | 17 +- 21 files changed, 524 insertions(+), 14 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/SECURITY.md create mode 100644 .github/pull_request_template.md create mode 100644 CONTRIBUTING.md create mode 100644 crates/vise-exporter/tests/version_match.rs create mode 100644 crates/vise-macros/tests/version_match.rs create mode 100644 crates/vise/tests/version_match.rs diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..2d3e38a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,39 @@ +--- +name: Bug report +about: Use this template for reporting issues +title: '' +labels: bug +assignees: '' +--- + +### 🐛 Bug Report + +#### 📝 Description + +Provide a clear and concise description of the bug. + +#### 🔄 Reproduction Steps + +Steps to reproduce the behaviour + +#### 🤔 Expected Behavior + +Describe what you expected to happen. + +#### 😯 Current Behavior + +Describe what actually happened. + +#### 🖥️ Environment + +Any relevant environment details. + +#### 📋 Additional Context + +Add any other context about the problem here. If applicable, add screenshots to help explain. + +#### 📎 Log Output + +``` +Paste any relevant log output here. +``` diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..d921e06 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,21 @@ +--- +name: Feature request +about: Use this template for requesting features +title: '' +labels: feat +assignees: '' +--- + +### 🌟 Feature Request + +#### 📝 Description + +Provide a clear and concise description of the feature you'd like to see. + +#### 🤔 Rationale + +Explain why this feature is important and how it benefits the project. + +#### 📋 Additional Context + +Add any other context or information about the feature request here. diff --git a/.github/SECURITY.md b/.github/SECURITY.md new file mode 100644 index 0000000..2f2871c --- /dev/null +++ b/.github/SECURITY.md @@ -0,0 +1,74 @@ +# Security Policy + +We truly appreciate efforts to discover and disclose security issues responsibly! + +## Vulnerabilities + +If you'd like to report a security issue in the repositories of matter-labs organization, please proceed to our +[Bug Bounty Program on Immunefi](https://era.zksync.io/docs/reference/troubleshooting/audit-bug-bounty.html#bug-bounty-program). + +## Other Security Issues + +We take an impact-first approach instead of a rules-first approach. Therefore, if you believe you found the impactful +issue but can't report it via the Bug Bounty, please email us at +[security@matterlabs.dev](mailto:security@matterlabs.dev). + +### PGP Key + +The following PGP key may be used to communicate sensitive information to developers: + +Fingerprint: `5FED B2D0 EA2C 4906 DD66 71D7 A2C5 0B40 CE3C F297` + +``` +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBGEBmQkBEAD6tlkBEZFMvR8kOgxXX857nC2+oTik6TopJz4uCskuqDaeldMy +l+26BBzLkIeO1loS+bzVgnNFJRrGt9gv98MzNEHJVv6D7GsSLlUX/pz7Lxn0J4ry +o5XIk3MQT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hBF/tstDqLEkG3WZx16LFC0DOPPKXBQJhAZleAhsM +AAoJEKLFC0DOPPKXAAEP/jK7ch9GkoaYlsuqY/aHtxEwVddUDOxjyn3FMDoln85L +/n8AmLQb2bcpKSqpaJwMbmfEyr5MDm8xnsBTfx3u6kgaLOWfKxjLQ6PM7kgIMdi4 +bfaRRuSEI1/R6c/hNpiGnzAeeexldH1we+eH1IVmh4crdat49S2xh7Qlv9ahvgsP +LfKl3rJ+aaX/Ok0AHzhvSfhFpPr1gAaGeaRt+rhlZsx2QyG4Ez8p2nDAcAzPiB3T +73ENoBIX6mTPfPm1UgrRyFKBqtUzAodz66j3r6ebBlWzIRg8iZenVMAxzjINAsxN +w1Bzfgsi5ZespfsSlmEaa7jJkqqDuEcLa2YuiFAue7Euqwz1aGeq1GfTicQioSCb +Ur/LGyz2Mj3ykbaP8p5mFVcUN51yQy6OcpvR/W1DfRT9SHFT/bCf9ixsjB2HlZGo +uxPJowwqmMgHd755ZzPDUM9YDgLI1yXdcYshObv3Wq537JAxnZJCGRK4Y8SwrMSh +8WRxlaM0AGWXiJFIDD4bQPIdnF3X8w0cGWE5Otkb8mMHOT+rFTVlDODwm1zF6oIG +PTwfVrpiZBwiUtfJol1exr/MzSPyGoJnYs3cRf2E3O+D1LbcR8w0LbjGuUy38Piz +ZO/vCeyJ3JZC5kE8nD+XBA4idwzh0BKEfH9t+WchQ3Up9rxyzLyQamoqt5Xby4pY +=xkM3 +-----END PGP PUBLIC KEY BLOCK----- +``` diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..37c8188 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,20 @@ +# What ❔ + + + + + +## Why ❔ + + + + +## Checklist + + + + +- [ ] PR title corresponds to the body of PR (we generate changelog entries from PRs). +- [ ] Tests for the changes have been added / updated. +- [ ] Documentation comments have been added / updated. +- [ ] Code has been formatted and linted using `cargo fmt` and `cargo clippy`. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..75df6f5 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,42 @@ +# Contribution Guidelines + +Hello! Thanks for your interest in `vise`! We welcome contributions from anyone on the internet, and are grateful +for even the smallest of fixes! + +## Ways to contribute + +There are many ways to contribute: + +1. Open issues: if you find a bug, have something you believe needs to be fixed, or have an idea for a feature, please + open an issue. +2. Add color to existing issues: provide screenshots, code snippets, and whatever you think would be helpful to resolve + issues. +3. Resolve issues: either by showing an issue isn't a problem and the current state is ok as is or by fixing the problem + and opening a PR. +4. Report security issues, see [our security policy](.github/SECURITY.md). +5. [Join the team!](https://matterlabs.notion.site/Shape-the-future-of-Ethereum-at-Matter-Labs-dfb3b5a037044bb3a8006af2eb0575e0) + +## Fixing issues + +To contribute code fixing issues, please fork the repo, fix an issue, commit, add documentation as per the PR template, +and the repo's maintainers will review the PR. See +[here](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork) +for guidance how to work with PRs created from a fork. + +## Licenses + +If you contribute to this project, your contributions will be made to the project under both [Apache 2.0](LICENSE-APACHE) +and [the MIT license](LICENSE-MIT). + +## Resources + +We aim to make it as easy as possible to contribute. This is still WIP, and we're happy for contributions +and suggestions here too. Some resources to help: + +1. Developer docs can be found in [repo's readme](README.md) + +## Code of Conduct + +Be polite and respectful. + +### Thank you diff --git a/Cargo.lock b/Cargo.lock index 99c9743..fc5246f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,6 +28,15 @@ dependencies = [ "version_check", ] +[[package]] +name = "aho-corasick" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f2135563fb5c609d2b2b87c1e8ce7bc41b0b45430fa9661f457981503dd5bf0" +dependencies = [ + "memchr", +] + [[package]] name = "assert_matches" version = "1.5.0" @@ -156,12 +165,27 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "form_urlencoded" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +dependencies = [ + "percent-encoding", +] + [[package]] name = "futures-channel" version = "0.3.28" @@ -227,6 +251,12 @@ dependencies = [ "ahash", ] +[[package]] +name = "hashbrown" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" + [[package]] name = "hermit-abi" version = "0.3.2" @@ -290,6 +320,16 @@ dependencies = [ "want", ] +[[package]] +name = "idna" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "indexmap" version = "1.9.3" @@ -300,6 +340,16 @@ dependencies = [ "hashbrown 0.12.3", ] +[[package]] +name = "indexmap" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +dependencies = [ + "equivalent", + "hashbrown 0.14.0", +] + [[package]] name = "itoa" version = "1.0.9" @@ -399,7 +449,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a4964177ddfdab1e3a2b37aec7cf320e14169abb0ed73999f558136409178d5" dependencies = [ "base64", - "indexmap", + "indexmap 1.9.3", "metrics", "metrics-util", "quanta", @@ -500,6 +550,12 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "percent-encoding" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" + [[package]] name = "pin-project-lite" version = "0.2.13" @@ -556,6 +612,17 @@ dependencies = [ "syn 2.0.29", ] +[[package]] +name = "pulldown-cmark" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a1a2f1f0a7ecff9c31abbe177637be0e97a0aef46cf8738ece09327985d998" +dependencies = [ + "bitflags", + "memchr", + "unicase", +] + [[package]] name = "quanta" version = "0.11.1" @@ -629,6 +696,35 @@ dependencies = [ "bitflags", ] +[[package]] +name = "regex" +version = "1.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" + [[package]] name = "rustc-demangle" version = "0.1.23" @@ -656,6 +752,35 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +[[package]] +name = "serde" +version = "1.0.188" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.188" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "serde_spanned" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" +dependencies = [ + "serde", +] + [[package]] name = "sketches-ddsketch" version = "0.2.1" @@ -736,6 +861,21 @@ dependencies = [ "syn 2.0.29", ] +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "tokio" version = "1.32.0" @@ -762,6 +902,40 @@ dependencies = [ "syn 2.0.29", ] +[[package]] +name = "toml" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.19.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap 2.0.0", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + [[package]] name = "tower-service" version = "0.3.2" @@ -806,12 +980,62 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +[[package]] +name = "unicase" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" +dependencies = [ + "version_check", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" + [[package]] name = "unicode-ident" version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "url" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "version-sync" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835169da0173ea373ddf5987632aac1f918967fbbe58195e304342282efa6089" +dependencies = [ + "proc-macro2", + "pulldown-cmark", + "regex", + "semver", + "syn 2.0.29", + "toml", + "url", +] + [[package]] name = "version_check" version = "0.9.4" @@ -830,6 +1054,7 @@ dependencies = [ "once_cell", "prometheus-client", "rand", + "version-sync", "vise-macros", ] @@ -844,6 +1069,7 @@ dependencies = [ "once_cell", "tokio", "tracing", + "version-sync", "vise", ] @@ -854,6 +1080,7 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.29", + "version-sync", ] [[package]] @@ -1022,3 +1249,12 @@ name = "windows_x86_64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "winnow" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c2e3184b9c4e92ad5167ca73039d0c42476302ab603e2fec4487511f38ccefc" +dependencies = [ + "memchr", +] diff --git a/Cargo.toml b/Cargo.toml index c59c71f..24a520c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,3 +32,4 @@ rand = "0.8" syn = { version = "2.0", features = ["full"] } tokio = "1" tracing = "0.1.37" +version-sync = "0.9.5" diff --git a/crates/vise-exporter/Cargo.toml b/crates/vise-exporter/Cargo.toml index 887b873..f574c0a 100644 --- a/crates/vise-exporter/Cargo.toml +++ b/crates/vise-exporter/Cargo.toml @@ -10,6 +10,11 @@ license.workspace = true keywords.workspace = true categories.workspace = true +[package.metadata.docs.rs] +all-features = true +# Set `docsrs` to enable unstable `doc(cfg(...))` attributes. +rustdoc-args = ["--cfg", "docsrs"] + [dependencies] vise = { version = "0.1.0", path = "../vise" } @@ -23,6 +28,7 @@ tracing.workspace = true doc-comment.workspace = true metrics.workspace = true tokio = { workspace = true, features = ["rt", "macros"] } +version-sync.workspace = true [features] default = [] diff --git a/crates/vise-exporter/README.md b/crates/vise-exporter/README.md index d537184..344e5a0 100644 --- a/crates/vise-exporter/README.md +++ b/crates/vise-exporter/README.md @@ -6,6 +6,13 @@ and push-based communication with Prometheus. ## Usage +Add this to your Crate.toml: + +```toml +[dependencies] +vise-exporter = "0.1.0" +``` + An exporter can be initialized from a metrics `Registry`: ```rust @@ -27,6 +34,8 @@ async fn my_app() { } ``` +See crate docs for more examples. + ## License Distributed under the terms of either diff --git a/crates/vise-exporter/src/lib.rs b/crates/vise-exporter/src/lib.rs index 6398f72..391567f 100644 --- a/crates/vise-exporter/src/lib.rs +++ b/crates/vise-exporter/src/lib.rs @@ -51,6 +51,9 @@ //! } //! ``` +// Documentation settings. +#![doc(html_root_url = "https://docs.rs/vise-exporter/0.1.0")] +#![cfg_attr(docsrs, feature(doc_cfg))] // Linter settings. #![warn(missing_debug_implementations, missing_docs, bare_trait_objects)] #![warn(clippy::all, clippy::pedantic)] @@ -321,6 +324,7 @@ impl MetricsExporter { /// If `exporter_fn` panics, it is propagated to the caller. #[must_use] #[cfg(feature = "legacy")] + #[cfg_attr(docsrs, doc(cfg(feature = "legacy")))] pub fn with_legacy_exporter(mut self, exporter_fn: F) -> Self where F: FnOnce(PrometheusBuilder) -> PrometheusBuilder, diff --git a/crates/vise-exporter/tests/version_match.rs b/crates/vise-exporter/tests/version_match.rs new file mode 100644 index 0000000..6a0284f --- /dev/null +++ b/crates/vise-exporter/tests/version_match.rs @@ -0,0 +1,11 @@ +use version_sync::{assert_html_root_url_updated, assert_markdown_deps_updated}; + +#[test] +fn readme_is_in_sync() { + assert_markdown_deps_updated!("README.md"); +} + +#[test] +fn html_root_url_is_in_sync() { + assert_html_root_url_updated!("src/lib.rs"); +} diff --git a/crates/vise-macros/Cargo.toml b/crates/vise-macros/Cargo.toml index acfadfd..23e1f84 100644 --- a/crates/vise-macros/Cargo.toml +++ b/crates/vise-macros/Cargo.toml @@ -17,3 +17,6 @@ proc-macro = true proc-macro2.workspace = true quote.workspace = true syn.workspace = true + +[dev-dependencies] +version-sync.workspace = true diff --git a/crates/vise-macros/src/lib.rs b/crates/vise-macros/src/lib.rs index 364044a..09fca54 100644 --- a/crates/vise-macros/src/lib.rs +++ b/crates/vise-macros/src/lib.rs @@ -1,6 +1,18 @@ -//! Metrics-related procedural macros. - +//! Procedural macros for the `vise` metrics client. +//! +//! All macros in this crate are re-exported from the [`vise`] crate. See its docs for more details +//! and the examples of usage. +//! +//! [`vise`]: https://docs.rs/vise/ + +// Documentation settings. +#![doc(html_root_url = "https://docs.rs/vise-macros/0.1.0")] +// General settings. #![recursion_limit = "128"] +// Linter settings. +#![warn(missing_debug_implementations, bare_trait_objects)] +#![warn(clippy::all, clippy::pedantic)] +#![allow(clippy::must_use_candidate, clippy::module_name_repetitions)] extern crate proc_macro; @@ -27,6 +39,6 @@ pub fn encode_label_set(input: TokenStream) -> TokenStream { } #[proc_macro_attribute] -pub fn register(attrs: TokenStream, input: TokenStream) -> TokenStream { - register::impl_register(attrs, input) +pub fn register(_attrs: TokenStream, input: TokenStream) -> TokenStream { + register::impl_register(input) } diff --git a/crates/vise-macros/src/metrics.rs b/crates/vise-macros/src/metrics.rs index 3fe3df1..d44ac20 100644 --- a/crates/vise-macros/src/metrics.rs +++ b/crates/vise-macros/src/metrics.rs @@ -20,7 +20,7 @@ impl fmt::Debug for MetricsAttrs { formatter .debug_struct("MetricsAttrs") .field("prefix", &self.prefix) - .finish() + .finish_non_exhaustive() } } @@ -91,7 +91,7 @@ impl fmt::Debug for MetricsField { .field("attrs", &self.attrs) .field("name", &self.name) .field("docs", &self.docs) - .finish() + .finish_non_exhaustive() } } diff --git a/crates/vise-macros/src/register.rs b/crates/vise-macros/src/register.rs index c9a3b7d..c06c53d 100644 --- a/crates/vise-macros/src/register.rs +++ b/crates/vise-macros/src/register.rs @@ -62,7 +62,7 @@ fn register_static(input: &mut ItemStatic) -> syn::Result TokenStream { +pub(crate) fn impl_register(input: TokenStream) -> TokenStream { let mut item: ItemStatic = match syn::parse(input) { Ok(item) => item, Err(err) => return err.into_compile_error().into(), diff --git a/crates/vise-macros/tests/version_match.rs b/crates/vise-macros/tests/version_match.rs new file mode 100644 index 0000000..d5b680f --- /dev/null +++ b/crates/vise-macros/tests/version_match.rs @@ -0,0 +1,6 @@ +use version_sync::assert_html_root_url_updated; + +#[test] +fn html_root_url_is_in_sync() { + assert_html_root_url_updated!("src/lib.rs"); +} diff --git a/crates/vise/Cargo.toml b/crates/vise/Cargo.toml index 9772bf6..6ee7e2f 100644 --- a/crates/vise/Cargo.toml +++ b/crates/vise/Cargo.toml @@ -23,3 +23,4 @@ assert_matches.workspace = true derive_more.workspace = true doc-comment.workspace = true rand.workspace = true +version-sync.workspace = true diff --git a/crates/vise/README.md b/crates/vise/README.md index 05c13c1..43a9913 100644 --- a/crates/vise/README.md +++ b/crates/vise/README.md @@ -26,6 +26,13 @@ should be reasonably small. ## Usage +Add this to your Crate.toml: + +```toml +[dependencies] +vise = "0.1.0" +``` + ### Defining and reporting metrics Metrics are defined as structs, with each field corresponding to a metric or a family of metrics: diff --git a/crates/vise/src/lib.rs b/crates/vise/src/lib.rs index c66dfb8..c0c1be2 100644 --- a/crates/vise/src/lib.rs +++ b/crates/vise/src/lib.rs @@ -113,6 +113,8 @@ //! metered_logic(my_metrics); //! ``` +// Documentation settings. +#![doc(html_root_url = "https://docs.rs/vise/0.1.0")] // Linter settings. #![warn(missing_debug_implementations, missing_docs, bare_trait_objects)] #![warn(clippy::all, clippy::pedantic)] diff --git a/crates/vise/tests/version_match.rs b/crates/vise/tests/version_match.rs new file mode 100644 index 0000000..6a0284f --- /dev/null +++ b/crates/vise/tests/version_match.rs @@ -0,0 +1,11 @@ +use version_sync::{assert_html_root_url_updated, assert_markdown_deps_updated}; + +#[test] +fn readme_is_in_sync() { + assert_markdown_deps_updated!("README.md"); +} + +#[test] +fn html_root_url_is_in_sync() { + assert_html_root_url_updated!("src/lib.rs"); +} diff --git a/deny.toml b/deny.toml index b4b8b57..9dc1dca 100644 --- a/deny.toml +++ b/deny.toml @@ -44,10 +44,15 @@ allow = [ multiple-versions = "deny" # Certain crates/versions that will be skipped when doing duplicate detection. skip = [ - # Old versions used by `metrics` - { name = "hashbrown", version = "=0.12.3" }, - # Old versions required by `derive_more` - { name = "syn", version = "=1.0.109" }, - # Old versions required by `hyper` - { name = "socket2", version = "=0.4.9" }, + # Old version used by `metrics-util`. A newer version is used by `version-sync` (a dev dependency). + { name = "hashbrown", version = "^0.13" }, + # Old `syn` version required by `derive_more`. Since it's a proc macro dep required + # from a dev dependency, having a duplicate version is sort of OK. + { name = "syn", version = "^1" }, + # Old version required by `hyper`. No fix available ATM. + { name = "socket2", version = "^0.4" }, +] +skip-tree = [ + # Old version used by `metrics` + { name = "indexmap", version = "^1" }, ]