Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test linter warnings #379

Merged
merged 2 commits into from
Apr 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ jobs:
uses: actions-rs/clippy-check@v1.0.7
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
args: --tests --all-features

check_msrv:
name: check (msrv)
Expand Down
3 changes: 1 addition & 2 deletions nats/tests/drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use nats::jetstream;
use smol::future::FutureExt;
use std::{
io,
Expand Down Expand Up @@ -172,7 +171,7 @@ fn close_responsiveness_regression_jetstream_complex() {
crossbeam_channel::Sender<i32>,
crossbeam_channel::Receiver<i32>,
) = crossbeam_channel::bounded(32);
sub.clone().with_process_handler(move |msg| {
sub.clone().with_process_handler(move |_| {
result_tx
.send(1)
.expect("failed to report back over channel");
Expand Down
43 changes: 18 additions & 25 deletions nats/tests/jetstream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ fn jetstream_not_enabled() {
.into_inner()
.expect("should be able to convert error into inner")
.downcast::<jetstream::Error>()
.expect("should be able to downcast into error")
.to_owned();
.expect("should be able to downcast into error");

assert_eq!(err.error_code(), jetstream::ErrorCode::NotEnabled);
}
Expand All @@ -51,8 +50,7 @@ fn jetstream_account_not_enabled() {
.into_inner()
.expect("should be able to convert error into inner")
.downcast::<jetstream::Error>()
.expect("should be able to downcast into jetstream::Error")
.to_owned();
.expect("should be able to downcast into jetstream::Error");

assert_eq!(err.error_code(), jetstream::ErrorCode::NotEnabledForAccount);
}
Expand Down Expand Up @@ -98,8 +96,7 @@ fn jetstream_publish() {
.into_inner()
.expect("should be able to convert error into inner")
.downcast::<jetstream::Error>()
.expect("should be able to downcast into error")
.to_owned();
.expect("should be able to downcast into error");

assert_eq!(err.error_code(), jetstream::ErrorCode::StreamNotMatch);

Expand All @@ -121,8 +118,7 @@ fn jetstream_publish() {
.into_inner()
.expect("should be able to convert error into inner")
.downcast::<jetstream::Error>()
.expect("should be able to downcast into error")
.to_owned();
.expect("should be able to downcast into error");

assert_eq!(
err.error_code(),
Expand Down Expand Up @@ -182,8 +178,7 @@ fn jetstream_publish() {
.into_inner()
.expect("should be able to convert error into inner")
.downcast::<jetstream::Error>()
.expect("should be able to downcast into error")
.to_owned();
.expect("should be able to downcast into error");

assert_eq!(err.error_code(), jetstream::ErrorCode::StreamWrongLastMsgId);
assert_eq!(js.stream_info("TEST").unwrap().state.messages, 2);
Expand All @@ -205,8 +200,7 @@ fn jetstream_publish() {
.into_inner()
.expect("should be able to convert error into inner")
.downcast::<jetstream::Error>()
.expect("should be able to downcast into error")
.to_owned();
.expect("should be able to downcast into error");

assert_eq!(
err.error_code(),
Expand Down Expand Up @@ -447,19 +441,18 @@ fn jetstream_queue_subscribe_no_mismatch_handle() {
})
.unwrap();

let c = jsm
.add_consumer(
"jobs_stream",
ConsumerConfig {
deliver_group: Some("dg".to_string()),
durable_name: Some("durable".to_string()),
deliver_policy: DeliverPolicy::All,
ack_policy: AckPolicy::Explicit,
deliver_subject: Some("deliver_subject".to_string()),
..Default::default()
},
)
.unwrap();
jsm.add_consumer(
"jobs_stream",
ConsumerConfig {
deliver_group: Some("dg".to_string()),
durable_name: Some("durable".to_string()),
deliver_policy: DeliverPolicy::All,
ack_policy: AckPolicy::Explicit,
deliver_subject: Some("deliver_subject".to_string()),
..Default::default()
},
)
.unwrap();

let job_sub = jsm
.queue_subscribe_with_options(
Expand Down
6 changes: 2 additions & 4 deletions nats/tests/object_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ fn object_random() {
bucket.info("FOO").unwrap_err();

let mut rng = rand::thread_rng();
let mut bytes = Vec::with_capacity(16 * 1024 * 1024 + 22);
bytes.resize(16 * 1024 * 1024 + 22, 0);
let mut bytes = vec![0; 1024 * 1024 + 22];
rng.try_fill_bytes(&mut bytes).unwrap();

bucket.put("FOO", &mut bytes.as_slice()).unwrap();
Expand All @@ -54,8 +53,7 @@ fn object_random() {

assert_eq!(result, bytes);

let mut bytes = Vec::with_capacity(1024 * 1024 + 22);
bytes.resize(1024 * 1024 + 22, 0);
let mut bytes = vec![0; 1024 * 1024 + 22];
rng.try_fill_bytes(&mut bytes).unwrap();
bucket.put("FOO", &mut bytes.as_slice()).unwrap();

Expand Down