Commit Graph

7499 Commits

Author SHA1 Message Date
Ian Jackson 01cb7ee0a1 clippy: in tests, allow clippy::useless_vec
This is a perf issue, only.  If tests are too slow, we will notice and
ca speed them up.  We should optimise for clarity and convenience,
rather than speed.

Forbidding this can result in churn between vec![] and [] as tests are
updated and changed.
2023-07-10 13:49:51 +01:00
Ian Jackson 43bf89d540 clippy: globally allow clippy::needless_raw_string_hashes
Rationale: no-one writes these by default without thinkinh.  If they
are unnecessary, then either the string must have had " in it
before (in which case it might do again), or it is near other strings
which *do* need it.

And having it does no harm; indeed IMO it can increase clarity.

Alternative to !1388's
  Fix new "needless_raw_string_hashes" lint from clippy +nightly
2023-07-10 13:49:51 +01:00
Nick Mathewson 9f3619d5c9 Merge branch 'clippy-vec' into 'main'
Fix new "useless_vec" warning from clippy +nightly

See merge request tpo/core/arti!1395
2023-07-10 12:07:31 +00:00
Ian Jackson 25b7573f58 Merge branch 'clippy-common' into 'main'
clippy +nightly: Uncontroversial adjustments from Nick

See merge request tpo/core/arti!1394
2023-07-10 12:01:02 +00:00
Ian Jackson 501454370f Fix new "useless_vec" warning from clippy +nightly
Explanation at
https://rust-lang.github.io/rust-clippy/master/index.html#/useless_vec

This is the non-tests subset of the same-named commmit in !1388,
(recreated by hand by me, and then checked against that commit;
I stole the commit message from Nick's.)

This should be uncontroversial I think.
2023-07-10 12:35:21 +01:00
Nick Mathewson 22f55b7cf8 Remove some needless into_iter() calls.
Clippy nightly now detects when you're calling into_iter() and
passing the result into something that accepts an
`impl IntoIterator`.
2023-07-10 12:33:21 +01:00
Nick Mathewson 0b6cc7ba5e Add exceptions for some cases of diverging_sub_expression
See here for documentation on the lint:
https://rust-lang.github.io/rust-clippy/master/index.html#/diverging_sub_expression

The issue here, from what I can tell, is that the lint triggers
whenever you use a diverging expression as a function body within an
2023-07-10 12:33:21 +01:00
Nick Mathewson 7e78224460 Add an exception for clippy::arc_with_non_send_sync.
We're doing this deliberately, I believe.
2023-07-10 12:33:21 +01:00
gabi-250 2db3e73434 Merge branch 'da-task' into 'main'
RFC: tor-rtmock: Use derive-adhoc for composite runtimes

See merge request tpo/core/arti!1381
2023-07-10 10:53:23 +00:00
Ian Jackson ca32680ba6 Merge branch 'onion-service-client-docs' into 'main'
Update documentation regarding the `onion-service-client` feature

See merge request tpo/core/arti!1392
2023-07-10 09:41:04 +00:00
Kunal Mehta 7acd7de369 Update documentation regarding the `onion-service-client` feature
It is no longer experimental, but still not rated for security-sensitive
usage per <https://blog.torproject.org/arti_116_released/>.
2023-07-07 22:01:51 -04:00
Ian Jackson 77b0dc2edc Merge branch 'raw_event_report' into 'main'
Fix warn_report and error_report macros.

See merge request tpo/core/arti!1390
2023-07-07 20:07:45 +00:00
Nick Mathewson 53c599d50f Fix warn_report and error_report macros.
Originally they didn't check err.kind(), since err.kind() can never
increase their severity.  We lost that behavior with !1386, and we
became dependent on it with arti!1383.  Since they both merged at
the same time, CI broke.

This patch restores their original behavior.
2023-07-07 15:46:41 -04:00
Nick Mathewson ba3876b22a Merge branch 'feat' into 'main'
arti: Build with HS client support by default

Closes #948

See merge request tpo/core/arti!1382
2023-07-07 19:28:05 +00:00
Nick Mathewson b6b7edad59 Merge branch 'event_report_everywhere' into 'main'
Throughout: Use event_report!() macros for reporting Errors.

Closes #949

See merge request tpo/core/arti!1383
2023-07-07 19:27:20 +00:00
Nick Mathewson b251784041 Merge branch 'fix-os-onionbalance' into 'main'
be more lenient while parsing inner hs desc

Closes #952

See merge request tpo/core/arti!1389
2023-07-07 19:26:27 +00:00
trinity-1686a 2d170425c0 be more lenient while parsing inner hs desc 2023-07-07 21:06:05 +02:00
Ian Jackson 778244c3af Merge branch 'report' into 'main'
tor-error: tracing module: Use macro to generate macros

See merge request tpo/core/arti!1386
2023-07-07 18:09:46 +00:00
Ian Jackson 08632739eb Document (retrospectively) the behaviour of 1.1.6 re HS client 2023-07-07 19:04:16 +01:00
Ian Jackson 696adc3c94 tor-error: tracing module: Use macro to generate macros
This abolishes some quintuplication.

The output is identical except that:
 * The syntax display in the rustdoc output for the resulting macros
   seems to have somewhat less whitepsace.
 * The whimsical error messages in the examples are all identical.
   Ah well.
2023-07-07 18:38:24 +01:00
Nick Mathewson 7d1c8dfde0 Merge branch 'inclusive' into 'main'
rng ranges: Use inclusive Duration ranges in several places

See merge request tpo/core/arti!1385
2023-07-07 17:07:58 +00:00
Nick Mathewson 25c6fe61e4 Throughout: Use *_report!() macros for reporting Errors.
I identified the cases to replace by searching for the string
`.report()`.  There are a few that I didn't change:

  * A couple of cases that used anyhow::Error,
  * One case that reported two Errors.
  * Two cases in `tor_hsclient::err` that just did
    `error!("Bug: {}")`.

I have also not audited the cases in `tor-hsclient` where we're using
`tor_error::Report` manually.

Nonetheless, closes #949.
2023-07-07 13:00:21 -04:00
Ian Jackson 220900a852 tor-error: tracing module: Fix link to tracing macro 2023-07-07 17:48:05 +01:00
Ian Jackson bcc3e6fef8 rng ranges: Use inclusive Duration ranges in several places
Many of these call sites would panic if, somehow, the upper bound was
zero.  In most cases it is very complicated to see if whether this
could happen.

However, there is a better answer:

Durations are (conceptually) dense, so picking the closed set (which
includes its boundary) rather than the open one (which doesn't) will
make little practical difference.

So change four call sites to use `..=` instead of just `..`.
2023-07-07 16:13:52 +01:00
Nick Mathewson 70f0fe634f Merge branch 'report-bugs-v2' into 'main'
Optional tracing support in tor-error for error reporting

See merge request tpo/core/arti!1379
2023-07-07 13:49:59 +00:00
Nick Mathewson 023d288ba2 event_report: assert correctness of format ending
(Also, document that this static assertion is the reason why you are
seeing a confusing error message.)
2023-07-07 09:00:31 -04:00
Nick Mathewson a441b4e9d3 circmgr: Use event_report!() and similar macros
This simplifies our logging a little, and implements part of
2023-07-07 09:00:31 -04:00
Nick Mathewson 7168feefdd tor-error: Add optional tracing support
The main contribution here is a set of convenience macros for
logging error `Report`s.  Notably, this macros always logs
`Internal` and `BadAspiUsage` errors at `WARN`, unless they
are already at `ERROR` or more.

This is a little tricky because `tracing::event!()` requires
its Level argument to be a constant.
2023-07-07 09:00:31 -04:00
Ian Jackson 80f397fb0b Merge branch 'allow_missing_panics' into 'main'
add_warning: Tolerate clippy::missing_panics_doc

Closes #950

See merge request tpo/core/arti!1380
2023-07-07 12:53:46 +00:00
Nick Mathewson 2b3d4150e3 Merge branch 'clippy-nightly-20230703' into 'main'
Fix various warnings from clippy nightly

Closes #943

See merge request tpo/core/arti!1369
2023-07-07 12:26:45 +00:00
Ian Jackson 4c0935e13a arti: Build with HS client support by default
Fixes #948
2023-07-07 12:54:08 +01:00
Ian Jackson 61344f68a5 arti Cargo.tomL: wrap default features list 2023-07-07 12:52:05 +01:00
Ian Jackson 6e495d8400 tor-rtmock: Use derive-adhoc for composite runtimes 2023-07-07 10:26:44 +01:00
Nick Mathewson 4caf86349c Remove explicit allows for missing_panics_docs.
These are no longer needed.
2023-07-06 14:36:13 -04:00
Nick Mathewson 03f9f9987a Run add_warning to remove `missing_panics_doc` deny.
Closes #950.
2023-07-06 14:32:23 -04:00
Nick Mathewson 7e2fa11065 add_warning: Tolerate clippy::missing_panics_doc
As of current nightly, this lint now includes expect()s,
which makes it trigger way more than we'd like.

See discussion on #950.
2023-07-06 14:29:40 -04:00
Nick Mathewson 07b4b11d7a Avoid matches!(x, None), matches!(x, Ok(_))
This appeases clippy-nightly.
2023-07-06 14:26:48 -04:00
Nick Mathewson 486b6b8c82 tor-rtcompat: Simplify trivial all() expressions.
Clippy nightly doesn't like `#[cfg(all(...))]` with only a single
expression inside the `all(...)`.

This requires an adjustment in check_doc_features.
2023-07-06 14:26:43 -04:00
gabi-250 34b7699fff Merge branch 'task5' into 'main'
tor-rtmock: Minor followups for impl_runtime

See merge request tpo/core/arti!1378
2023-07-06 16:05:30 +00:00
Ian Jackson de97288c53 tor-rtmock: statically assert that the macro makes a Runtime impl 2023-07-06 15:58:42 +01:00
Ian Jackson f0168b5220 tor-rtmock: Use the same specified field for BlockOn and Spawn
These are always the same and probably always will be.
2023-07-06 15:58:42 +01:00
Ian Jackson 1ec339daf4 Merge branch 'task4' into 'main'
Introduce a MockExecutor for fully-isolated test cases

See merge request tpo/core/arti!1375
2023-07-06 14:41:04 +00:00
Nick Mathewson 36a92e44d9 Merge branch 'log_precision' into 'main'
arti: Add a `logging.time_granularity` option with 1s default.

Closes #551

See merge request tpo/core/arti!1376
2023-07-06 14:37:49 +00:00
Ian Jackson 0b8b965cf7 tor-rtmock: Add semver.md 2023-07-06 15:14:41 +01:00
Ian Jackson 6ed8e0b669 tor-rtmock: task: Fix a typo
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1375#note_2919976
2023-07-06 15:14:41 +01:00
Ian Jackson 7e7428611e tor-rtmock: task: clarify progress_until_stalled a little 2023-07-06 15:14:41 +01:00
Ian Jackson 6aff623c08 tor-rtmock: Runtime: Expand on "allowed" documentation 2023-07-06 15:14:41 +01:00
Ian Jackson 02293bd42d tor-rtmock: task: Remove a () assignment
Discussion:
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1375#note_2919928
2023-07-06 15:14:41 +01:00
Ian Jackson 89994142d3 tor-rtmock: task: Abolish TaskFutureInfo alias (fmt) 2023-07-06 15:14:41 +01:00
Ian Jackson 78071c30ef tor-rtmock: task: Abolish TaskFutureInfo alias
Requested by:
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1375#note_2919926
2023-07-06 15:14:41 +01:00