| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| |
|
|
| |
Removed unnecessary lint
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
| |
`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.
|
| |
|
|
| |
This adds the lint to all our crates.
|
| |
|
|
| |
Run maint/add_warning
|
| |
|
|
| |
This feature has been removed from nightly, in favor of doc_cfg.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
| |
See #2060.
|
| |
|
|
|
|
| |
Denies 'mod.rs' files for consistency.
https://rust-lang.github.io/rust-clippy/master/index.html#mod_module_files
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
We are about to need this in `tor-keymgr`, where we're about to add a
config for C Tor service keystores (the C Tor keystore config will have
an associated `HsNickname` that specifies which of the arti hidden
services it's supposed to be used with).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes
cargo check -p tor-circmgr --all-features --all-targets
which otherwise prints
warning: variant `InstanceState` is never constructed
--> crates/tor-persist/src/err.rs:45:5
|
13 | pub(crate) enum Resource {
| -------- variant in this enum
...
45 | InstanceState {
| ^^^^^^^^^^^^^
|
= note: `Resource` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis
= note: `#[warn(dead_code)]` on by default
warning: variants `Deleting` and `Enumerating` are never constructed
--> crates/tor-persist/src/err.rs:66:5
|
57 | pub(crate) enum Action {
| ------ variants in this enum
...
66 | Deleting,
| ^^^^^^^^
...
78 | Enumerating,
| ^^^^^^^^^^^
|
= note: `Action` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis
warning: method `delete` is never used
--> crates/tor-persist/src/load_store.rs:83:19
|
35 | impl Target<'_> {
| --------------- method in this implementation
...
83 | pub(crate) fn delete(&self) -> Result<(), ErrorSource> {
| ^^^^^^
|
| |
|
|
| |
This commit is automatically generated.
|
| | |
|
| |
|
|
| |
The formatting will be normalised roughly as we go.
|
| |
|
|
|
|
|
|
|
| |
I need this for state_dir (#1163, !1853).
I intend that this should be used for arti paths (#1092, #1193).
See also #1195.
Implements the spec in #1192 but doesn't connect it to anything yet.
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
And, instead of being a hidden module, it's a public experimental one.
I have feature-gated all the new dependencies since we probably want
to feature-gate this module in perpetuity, since some builds of Arti
won't need it.
Closes #1205
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This code needs fs_mistrust::Error and tor_error::ErrorKind. I think
we probably don't want fs_mistrust to depend on tor_error or vice
versa.
tor_persist is approximately the place where these two threads of
thought come together, and it's currently the lowest place where this
is needed.
Use it in tor-dirmgr too, which is currently the other place that
embodies this knowledge about fs_mistrust::Error.
|
| |
|
|
|
| |
I see other problems with this API, see #1136. but we can at least
easily do this.
|
| | |
|
| | |
|
| |
|
|
| |
Closes #950.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
|
|
| |
Apparently cargo fmt doesn't like these, which my perl rune didn't
delete.
This commit is precisely the result of `cargo fmt`.
|
| |
|
|
|
|
|
|
| |
The feature we want is `#[doc = include_str!("README.md")]`, which is
stable since 1.54 and our MSRV is now 1.56.
This commit is precisely the result of the following Perl rune:
perl -i~ -0777 -pe 's{(^//!(?!.*\@\@).*\n)+}{#![doc = include_str!("../README.md")]\n}m' crates/*/src/lib.rs
|
| | |
|
| |
|
|
| |
`NoLock` is now a variant of `err::ErrorSource` but that is private.
|
| | |
|
| |
|
|
| |
Update all lint blocks
|
| |
|
|
|
| |
From running add_warning, with manual picking of the right
hunks/lines.
|
| |
|
|
|
|
| |
This was the result of:
maint/add_warning crates/*/src/{lib,main}.rs
and then manually curating the results.
|
| | |
|
| |
|
|
| |
Having a consistent order will make the nest commit easier to read.
|
| |\
| |
| |
| |
| | |
Disable clippy::clone_on_ref_ptr
See merge request tpo/core/arti!352
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This lint is IMO inherently ill-conceived.
I have looked for the reasons why this might be thought to be a good
idea and there were basically two (and they are sort of contradictory):
I. "Calling ‘.clone()` on an Rc, Arc, or Weak can obscure the fact
that only the pointer is being cloned, not the underlying data."
This is the wording from
https://rust-lang.github.io/rust-clippy/v0.0.212/#clone_on_ref_ptr
It is a bit terse; we are left to infer why it is a bad idea to
obscure this fact. It seems to me that if it is bad to obscure some
fact, that must be because the fact is a hazard. But why would it be
a hazard to not copy the underlying data ?
In other languages, faliing to copy the underlying data is a serious
correctness hazard. There is a whose class of bugs where things were
not copied, and then mutated and/or reused in multiple places in ways
that were not what the programmer intended. In my experience, this is
a very common bug when writing Python and Javascript. I'm told it's
common in golang too.
But in Rust this bug is much much harder to write. The data inside an
Arc is immutable. To have this bug you'd have use interior mutability
- ie mess around with Mutex or RefCell. That provides a good barrier
to these kind of accidents.
II. "The reason for writing Rc::clone and Arc::clone [is] to make it
clear that only the pointer is being cloned, as opposed to the
underlying data. The former is always fast, while the latter can
be very expensive depending on what is being cloned."
This is the reasoning found here
https://github.com/rust-lang/rust-clippy/issues/2048
This is saying that *not* using Arc::clone is hazardous.
Specifically, that a deep clone is a performance hazard.
But for this argument, the lint is precisely backwards. It's linting
the "good" case and asking for it to be written in a more explicit
way; while the supposedly bad case can be written conveniently.
Also, many objects (in our codebase, and in all the libraries we use)
that are Clone are in fact simply handles. They contain Arc(s) (or
similar) and are cheap to clone. Indeed, that is the usual case.
It does not make sense to distinguish in the syntax we use to clone
such a handle, whether the handle is a transparent Arc, or an opaque
struct containing one or more other handles.
Forcing Arc::clone to be written as such makes for code churn when a
type is changed from Arc<Something> to Something: Clone, or vice
versa.
|
| |/
|
|
|
|
|
|
|
|
|
|
| |
`StateMgr` got a new `unlock()` method that does what it says on the
tin. We now call it from `bootstrap()` using the new
`util::StateMgrUnlockGuard`, which works in a manner similar to the
`BoolResetter` from `tor_dirmgr`.
(A decent small little task in future might be to unify these types in
some sort of general arti utility crate?)
closes arti#335
|
| |\ |
|
| | |
| |
| |
| |
| |
| | |
To implement this, we had to refactor the tor_circmgr api for
flushing state changes to disk, so that it checks if it has the lock,
and only then tries to store.
|
| |/
|
|
|
| |
This exception is no longer necessary now that the underlying CI bug
is fixed.
|
| |
|
|
| |
Closes #338.
|
| | |
|
| |
|
|
|
| |
And change the comments to slightly reinterpret these errors, to
relate to the circumstances rather than error generation site.
|
| |
|
|
|
|
|
|
| |
Serialisation errors ought not to occur, since they would represent an
attempt to store malformed data, or something. (We always convert to
a string, so the JSON error never contains IO errors or the like.)
Deserialisation errors mean the persistent state is corrupt.
|
| | |
|
| | |
|