summaryrefslogtreecommitdiff
path: root/crates/tor-basic-utils/src/lib.rs
Commit message (Collapse)AuthorAgeFilesLines
* Add derive-deftly to tor-basic-utilsClara Engler2026-06-241-0/+3
| | | | We will make use of it in the next commit.
* Merge branch 'misc_string_slices_1' into 'main'Clara Engler2026-06-181-4/+2
|\ | | | | | | | | Fix string_slice exceptions outside of netdoc See merge request tpo/core/arti!4092
| * basic-utils: remove str slice usageNick Mathewson2026-06-101-4/+2
| |
* | tor-basic-utils: iter_join: Take IntoIterator, not just IteratorIan Jackson2026-06-111-4/+4
| |
* | assert_not_impl: Support genericsIan Jackson2026-06-101-5/+22
| | | | | | | | | | I want to call this in one of tor-netdoc's parse2 derives, which *do* support generics.
* | assert_not_impl: Support generics - prepIan Jackson2026-06-101-2/+5
| | | | | | | | | | If we move this let into the item impl, it will have access to the generics we're about to add to the `impl $rule`.
* | assert_not_impl: Formally document input syntaxIan Jackson2026-06-101-1/+15
| | | | | | | | | | | | | | Previously we were relying on the macro_rules pattern being in the rustdoc. But it's about to get more complex. Document it manually.
* | assert_not_impl: Regularise example syntaxIan Jackson2026-06-101-4/+4
| | | | | | | | | | Usually Rust doesn't put a space after `:` in trait bounds. But it does when calling a macro with { } syntax.
* | assert_not_impl: Fix a mendacious headingIan Jackson2026-06-101-1/+1
| | | | | | | | | | This bit of the doc contains both succeeding and failing examples, each marked with an appropriate comment.
* | assert_not_impl: Promote to tor-basic-utilsIan Jackson2026-06-101-0/+42
|/ | | | | | | I want this in tor-netdoc (which doesn't use tor-config and probably shouldn't). Almost entirely code motion. Review with --color-moved.
* everywhere: Add #[allow(clippy::string_slice)]Clara Engler2026-06-091-0/+1
| | | | | | | | This commit adds #[allow(clippy::string_slice)] to all functions in the code where string slices are used, alongside a TODO comment. We do this add the function header to have it consistent, as things like expression based allow's are still experimental.
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-091-0/+2
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* proto: Move TokenBucket to tor-basic-utilsDavid Goulet2026-06-081-0/+1
| | | | Signed-off-by: David Goulet <[email protected]>
* tor-basic-utils: Add an if_empty helper macroNick Mathewson2026-05-271-0/+16
| | | | | We need this pattern in a lot of places; we might as well just define it once.
* tor-basic-utils: Correct documentation for macro_first_nonempty.Nick Mathewson2026-05-271-5/+5
| | | | | It looks like we renamed this macro, but didn't rename it in its documentation.
* clippy: Work around bug where it claims method doesn't existIan Jackson2026-05-131-0/+6
| | | | | | | | | | | | Fixes warning: `rand::RngExt::random_range` does not refer to a reachable function --> /volatile/rustcargo/Rustup/Arti/arti/clippy.toml:7:5 | 7 | { path = "rand::RngExt::random_range", reason = "Prefer tor_basic_utils::RngExt::gen_range_checked to avoid uncontrolled panics, or gen_range_infallible if applicable" }, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add `allow-invalid = true` to the entry to suppress this warning
* Upgrade rand crates to 0.10.Wesley Aptekar-Cassels2026-05-121-2/+3
| | | | | | | | | | | When the circ-padding feature is enabled, we use maybenot, which does not yet support rand 0.10. In the meantime, enabling this feature pulls in rand 0.9. This is not ideal, but should be okay as a temporary situation. This also replaces the use of ReseedingRng (which was removed in 0.10) with the reseeding_rng crate. This is somewhat less performant, but it should be okay.
* tor-basic-utils: remove `flatten`Nick Mathewson2026-05-071-15/+0
| | | | | It is no longer needed since we require Rust 1.89. Nobody was using it.
* tor-basic-utils: Update comment about std::fmt::from_fn.Nick Mathewson2026-05-071-1/+1
| | | | We now know when it was stabilized, so we can say when to use it.
* tor-basic-utils: Remove IoErrorExt and BinaryHeapExt.Nick Mathewson2026-03-251-50/+0
| | | | | | | | | | IoErrorExt existed to provide a workaround for Rust versions that didn't have io::ErrorKind::NotADirectory. But NotADirectory was stabilized in 1.83 and our MSRV is 1.89. BinaryHeapExt existed to provide an implementation for Rust versions that didn't have BinaryHeap::retain. But BinaryHeap::retain was stabilized in 1.70 and our MSRV is 1.70.
* tor-basic-utils: clean up `iter_join`Steven Engler2026-03-031-8/+6
|
* tor-basic-utils: move `iter_join` from arti-relaySteven Engler2026-03-031-0/+33
| | | | Will clean this up in the following commit.
* Allow clippy::collapsible_if to triggerGabriela Moldovan2026-02-161-0/+1
| | | | | | | | | `clippy::collapsible_if` started triggering after bumping the MSRV to 1.88. Since this triggers from a lot of places, and since there even are a couple of instances where we explicitly allow `clippy::collapsible_ifs`, I've opened #2342 for deciding what to do about it.
* tor-basic-utils: Add utility to iterate over error sourcesRobert Bartlensky2026-02-141-0/+1
|
* maint/add_warning: Run script to add new warningGabriela Moldovan2026-01-271-0/+1
| | | | This adds the lint to all our crates.
* Move intern from tor-netdir to tor-basic-utils and make it pubNick Mathewson2025-12-031-0/+1
|
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-2/+2
| | | | Run maint/add_warning
* tor-basic-utils: New function to generate random hostname.Nick Mathewson2025-10-071-0/+1
| | | | | | We'll be using this for x509 certificates in #2197. We might also use it for SNI/ESNI as in !198.
* Remove "doc_auto_cfg" incantation from all crates.Nick Mathewson2025-09-291-1/+1
| | | | This feature has been removed from nightly, in favor of doc_cfg.
* Fix a comment about Result::flattenNick Mathewson2025-08-071-2/+3
| | | | Previously this API was nightly-only; now it's in 1.89.
* tor-basic-utils: add `assert_val_impl_trait!` macroSteven Engler2025-07-171-0/+19
|
* Temporarily suppress mismatched_lifetime_syntaxes.Gabriela Moldovan2025-07-071-0/+1
| | | | See #2060.
* tor-basic-utils: standardized MSRV TODOshashcatHitman2025-04-161-1/+1
| | | | | - Part of a series of commits aimed at replacing all MSRV-related TODOs with a standardized format, which should be easier to find when the MSRV is bumped.
* tor-basic-utils: move `flatten` from tor-protoSteven Engler2025-03-251-0/+14
| | | | I also added an additional non-doc TODO comment.
* squash! Upgrade rand dependency to 0.9.Nick Mathewson2025-03-181-1/+5
| | | | - `Rng::gen_range()` has been renamed to `Rng::random_range()`
* squash! Upgrade rand dependency to 0.9.Nick Mathewson2025-03-181-6/+6
| | | | - The rand::distributions module has been renamed to rand::distr
* squash! Upgrade rand dependency to 0.9.Nick Mathewson2025-03-181-2/+2
| | | | - `rand::thread_rng()` has been deprecated and renamed to `rand::rng()`
* Always use full path to rand::thread_rng().Nick Mathewson2025-03-181-4/+2
| | | | | This is partly for consistency, and partly to facilitate a global search-and-replace.
* clippy: deny `mod_module_files`Steven Engler2025-01-061-0/+1
| | | | | | Denies 'mod.rs' files for consistency. https://rust-lang.github.io/rust-clippy/master/index.html#mod_module_files
* add_warnings, *: Allow clippy::needless_lifetimesNick Mathewson2024-12-031-0/+1
| | | | | | | | In 1.83, this warning triggers on many of our crates. We're thinking of fixing them all, but for now, we're going to disable the warning. This is part of #1765.
* tor-basic-utils: add `n_key_list` macroSteven Engler2024-09-231-0/+1
| | | | | This is based off of the `n_key_set` macro, but lets you store multiple items per key.
* byte_qty: Move to tor-basic-utilsIan Jackson2024-08-271-0/+3
| | | | Code motion of byte_qty.rs, and minimal necessary supporting changes.
* Re-run maint/add_warning.Nick Mathewson2024-05-061-2/+2
| | | | This commit is automatically generated.
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* tor-basic-utils: Provide PathExt with display_lossy() methodIan Jackson2024-03-051-0/+25
|
* deny clippy::unchecked_duration_subtractiontrinity-1686a2024-02-291-0/+1
|
* tor-basic-utils: Seal IoErrorExtIan Jackson2023-10-101-1/+9
|
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-231-0/+1
|
* Run add_warnings on all files.Nick Mathewson2023-08-041-2/+2
|
* Merge branch 'clippy-allow' into 'main'Ian Jackson2023-07-111-0/+2
|\ | | | | | | | | clippy: Allow some of our existing code patterns See merge request tpo/core/arti!1396