aboutsummaryrefslogtreecommitdiff
path: root/crates/safelog/src/lib.rs
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'remove-lint' into 'main'Jim Newsome2026-07-151-1/+1
|\ | | | | | | | | | | | | Removed unnecessary lint Closes #2556 See merge request tpo/core/arti!4210
| * add_warning: add reference to arti#2556Jim Newsome2026-07-151-1/+1
| |
| * Removed unnecessary lintpryty262026-07-151-1/+1
| | | | | | | | Removed unnecessary lint
* | safelog: Fix clippy warningshjrgrn2026-07-101-5/+5
|/
* safelog: Define redaction helpers to avoid string slicing.Nick Mathewson2026-06-101-0/+1
| | | | | | (Several of our remaining string slicing instances are for redaction, and it makes sense to have a single tested implementation for this.)
* 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.
* safelog: Add new MaybeSensitive::map() functionGabriela Moldovan2026-04-231-0/+15
| | | | | This is analogous to `Option::map()`, and can be useful when you need to map the inner type of a `MaybeSensitive` to another type.
* safelog: Rename MaybeSensitive::hidden/visible()David Goulet2026-03-031-4/+4
| | | | | | Rename them to respectively sensitive() and not_sensitive(). Signed-off-by: David Goulet <[email protected]>
* safelog: Add MaybeSensitive structDavid Goulet2026-03-031-0/+47
| | | | | | | This is meant to be like MaybeRedacted but for the Sensitive<> container. Signed-off-by: David Goulet <[email protected]>
* 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.
* maint/add_warning: Run script to add new warningGabriela Moldovan2026-01-271-0/+1
| | | | This adds the lint to all our crates.
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-2/+2
| | | | Run maint/add_warning
* 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.
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-1/+1
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.
* Use new DisplayRedacted/DebugRedacted code for HsId.Nick Mathewson2025-07-311-0/+1
| | | | Closes #2012.
* safelog: Add new DisplayRedacted/DebugRedacted APIs.Nick Mathewson2025-07-311-0/+174
| | | | | | | These APIs differ from Redactable by forcing the caller to choose whether an object should be displayed in redacted or non-redacted form. (Redactable objects still implement Display, which creates the risk of accidentally displaying an un-redacted object.)
* Temporarily suppress mismatched_lifetime_syntaxes.Gabriela Moldovan2025-07-071-0/+1
| | | | See #2060.
* 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.
* safelog: derive Clone and Copy for Sensitive and RedactedIan Jackson2024-10-011-4/+2
| | | | | educe has bugs that mean it applies a Copy bound to its Clone impl. Anyway, we just want to derive these normally, not do something weird.
* 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
|
* deny clippy::unchecked_duration_subtractiontrinity-1686a2024-02-291-0/+1
|
* 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
|
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-101-0/+2
|
* Run add_warning to remove `missing_panics_doc` deny.Nick Mathewson2023-07-061-1/+0
| | | | Closes #950.
* lints: Run maint/add_warning to actually apply new lintsIan Jackson2023-06-211-0/+2
|
* safelog: Provide Redacted.as_inner() and .as_ref()Ian Jackson2023-06-091-0/+13
| | | | Just like for Sensitive.
* safelog: impl From<T> for Redacted<T>Ian Jackson2023-03-231-0/+1
| | | | I think this is uncontroversial; we already have it for Sensitive.
* Allow clippy::unchecked_duration_subtraction in testsNick Mathewson2023-01-271-0/+1
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* Disable clippy::unlinlined-format-argsNick Mathewson2023-01-271-0/+1
| | | | | | | | This warning kind of snuck up on us! (See #748) For now, let's disable it. (I've cleaned it up in a couple of examples, since those are meant to be more idiomatic and user-facing.) Closes #748.
* Merge branch 'test-lints' into 'main'eta2023-01-061-0/+8
|\ | | | | | | | | Add test lint blocks to all "mod test" See merge request tpo/core/arti!937
| * test lint blocks: Add many many automaticallyIan Jackson2022-12-121-0/+8
| | | | | | | | | | This is precisely the result of running the rune in maint/adhoc-add-lint-blocks.
* | Rename Sensitive::into_inner() from ::unwrap()Ian Jackson2022-12-121-5/+19
|/ | | | | | | | | | By analogy with similar methods on Mutex, Cell, BufReader, etc. etc. Discussed here https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/890#note_2856885 Make it a method, as per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/928
* safelog: tests for accessors.Nick Mathewson2022-12-061-0/+2
|
* safelog: tests for BoxSensitive.Nick Mathewson2022-12-061-0/+17
|
* safelog: more tests for Redacted.Nick Mathewson2022-12-061-3/+15
|
* safelog: Apply #[serial] to test_redacted()Nick Mathewson2022-11-301-0/+1
| | | | Closes #675.
* Fix a logic error in Redacted.Nick Mathewson2022-11-301-4/+13
| | | | | | | Previously it was redacting exactly when safelogging was _disabled_, which obviously isn't correct. Fixes #671. Regression test included.
* safelog: Make MaybeRedacted<T> opaque.Nick Mathewson2022-11-281-22/+8
|
* Add a default debug_redacted impl to save space.Nick Mathewson2022-11-281-5/+3
|
* safelog: Add a MaybeRedacted wrapper too.Nick Mathewson2022-11-281-0/+38
| | | | | This is super helpful for cases where we want to write two nearly identical implementations to format a type.
* safelog: implement Redactable for network addr types.Nick Mathewson2022-11-281-0/+1
|
* safelog: Define a "Redactable" traitNick Mathewson2022-11-281-0/+91
| | | | | | A "redactable" object is one that can be _partially_ scrubbed in sensitive contexts. This can be very helpful for UX, but is not risk-free: see comments.
* safelog: Provide BoxSensitiveIan Jackson2022-11-231-0/+47
|
* safelog: Remove type argument from `impl_display_traits`Ian Jackson2022-11-231-3/+3
| | | | | | We're going to have this same macro implement the same traits for a second type. And its function is specific to `Sensitive`, so have it know that.
* safelog: Provide some more accessorsIan Jackson2022-11-231-0/+15
| | | | | We're about to use `.as_inner()` in a few places, and `.as_ref()` (by analogy with `Option`) seems obviously necessary.
* Run add_warnings.Nick Mathewson2022-11-031-0/+1
|
* cargo fmt to remove blank linesIan Jackson2022-10-121-1/+0
| | | | | | | Apparently cargo fmt doesn't like these, which my perl rune didn't delete. This commit is precisely the result of `cargo fmt`.