> Check `implicit_clone` section of Clippy documentation for details;
>
> https://rust-lang.github.io/rust-clippy/master/index.html#implicit_clone
This adds, and addresses, the following Clippy configuration to crates;
#![deny(clippy::implicit_clone)]
And moves related line within `maint/add_warning.py` file. My intent is to
mitigate extra edits after merging, so please let me know if I need to do this
last bit differently.
> Check `missing_panics_doc` section of Clippy documentation for details;
>
> https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
This adds the following Clippy configuration to crates;
#![deny(clippy::missing_panics_doc)]
And adds necessary doc-comments to methods that may panic.
> Check `cast_lossless` section of Clippy documentation for details;
>
> https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless
This adds the following Clippy configuration to crates;
#![deny(clippy::cast_lossless)]
And applies suggested Clippy and `cargo fmt` fixes.
Loop into several reads because we want to short-circuit if case we're
reading too many bytes.
Added handling of allocation of `result` so we can use the "next window
buffer" for `read`. This way we can read on steps and short-circuit when
needed.
Previously the DirResponse contained a String for the output.
By changing it to a Vec<u8> the caller has to parse the Vec<u8> and deal with potential failures.
With this change `fetch_multiple`'s
`useful_responses` should also contain non-UTF-8 responses.
This will case an Err to be returned in the `download_attempt` function if the
DirResponse does not contain valid UTF-8.
Thanks to cargo's version-2 feature resolver, we can require a
runtime for tests only.
I'm also making it so that the functions that create or fetch
Runtimes only exist when one of the runtime features is enabled.
For now that seems like a better solution than having those
functions exist but panic.
Closes#129.
As with the tor-chanmgr code, the circuit manager is now implemented
using an AbstractCircMgr type that uses traits to abstract the
particular behavior of other types that it uses. (Specifically:
circuits, building circuits, and telling whether one circuit usage
is compatible with another.) Abstracting out the dependencies in
this ways makes it possible to test the circuit manager without
having to actually build real circuits.
This commit also introduces new behavior for handling pending
circuit requests. Upon getting a new request, first we check to see
if there's an existing circuit we can use. If there isn't, we look
for pending circuits and wait for them. If there aren't any pending
circuits we can use, we launch one or more, and wait for them.
So far, that's the same as the old behavior. But here's a change:
if, while we are waiting for some pending circuits, a different
circuit is completed, and it's one we could use, then the task that
was building _that_ circuit will tell us: "please look at this
circuit". This gives us better changes of getting a usable circuit
fast.
Minor changes:
* The Error type in CircMgr no longer uses anyhow; several errors
have been simplified.
* We've gotten more formal about the relationship between circuit
usage and target usage.
This is a somewhat obnoxious change in its scope and requirements,
but it makes it easier to understand what the real public and
private parts of our APIs are.
Rust 1.52 just came out, and there are new clippy lints to deal
with:
* It spots more cases when we could use Option::map
* It spots more cases when we could use Iterator::flatten
* When we build a struct instance, it wants us to list the fields
in the same order that the struct declares them.
These lints force us to declare our exported enums and
exhaustive-looking structs as non-exhaustive (so that we can add to
them in the future without breaking our API) or to explicitly
disable the warning for a given enum/struct (to say that we _intend_
for additions to be a breaking change).