- 
                Notifications
    
You must be signed in to change notification settings  - Fork 36
 
Closed
Description
I'm running macOS 10.14.6.
Reproduction Steps:
git clone https://github.com/aerospike/aerospike-client-rust.git \
 && docker run -v ${HOME}/.aerospike/data:/opt/aerospike/data -e "NAMESPACE=test" --rm -d -p 3000:3000 --name aerospike aerospike/aerospike-server \
 && cd aerospike-client-rust \
 && cargo test
Results:
running 20 tests
test bin::tests::into_bins ... ok
test net::parser::tests::read_addr_part ... ok
test net::host::tests::to_hosts ... ok
test key::tests::unsupported_float_key ... ok
test key::tests::unsupported_u64_key ... ok
test net::parser::tests::read_addr_tuple ... ok
test query::filter::tests::geo_filter_macros ... ok
test net::parser::tests::read_hosts ... ok
test record::tests::ttl_expiration_future ... ok
test record::tests::ttl_expiration_past ... ok
test record::tests::ttl_never_expires ... ok
test result_code::tests::from_result_code ... ok
test result_code::tests::from_unknown_result_code ... ok
test result_code::tests::into_string ... ok
test result_code::tests::unknown_into_string ... ok
test value::tests::as_geo ... ok
test value::tests::as_string ... ok
test key::tests::int_keys ... ok
test key::tests::string_keys ... ok
test key::tests::blob_keys ... ok
test result: ok. 20 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
     Running target/debug/deps/client-0cb4beb2f607c922
running 5 tests
test cluster_name ... ok
test nodes ... ok
test get_node ... ok
test node_names ... ok
test close ... ok
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
     Running target/debug/deps/lib-33687cbfd16d35e7
running 27 tests
test src::batch::batch_get ... ok
test src::cdt_bitwise::cdt_bitwise ... ok
test src::cdt_list::cdt_list ... ok
test src::cdt_map::map_operations ... ok
test src::exp::expression_rec_ops ... FAILED
test src::exp::expression_commands ... ok
test src::hll::hll ... ok
test src::index::recreate_index ... ok
test src::kv::connect ... ok
test src::exp::expression_condition ... ok
test src::query::query_multi_consumer ... ok
test src::query::query_nobins ... ok
test src::exp::expression_data_types ... ok
test src::exp::expression_compare ... ok
test src::query::query_node ... ok
test src::query::query_single_consumer ... ok
test src::exp_hll::expression_hll ... ok
test src::task::index_task_test ... ok
test src::truncate::truncate ... ok
test src::scan::scan_multi_consumer ... ok
test src::udf::execute_udf ... ok
test src::scan::scan_single_consumer ... ok
test src::scan::scan_node ... ok
test src::task::register_task_test ... ok
test src::exp_bitwise::expression_bitwise ... ok
test src::exp_list::expression_list ... ok
test src::exp_map::expression_map ... ok
failures:
---- src::exp::expression_rec_ops stdout ----
thread 'src::exp::expression_rec_ops' panicked at 'assertion failed: `(left == right)`
  left: `0`,
 right: `100`: DEVICE SIZE Test Failed', tests/src/exp.rs:244:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Running cargo clippy:
warning: this could be a `const fn`
   --> src/value.rs:221:5
    |
221 | /     pub fn is_nil(&self) -> bool {
222 | |         match *self {
223 | |             Value::Nil => true,
224 | |             _ => false,
225 | |         }
226 | |     }
    | |_____^
    |
note: the lint level is defined here
   --> src/lib.rs:25:40
    |
25  | #![warn(clippy::all, clippy::pedantic, clippy::nursery)]
    |                                        ^^^^^^^^^^^^^^^
    = note: `#[warn(clippy::missing_const_for_fn)]` implied by `#[warn(clippy::nursery)]`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
warning: match expression looks like `matches!` macro
   --> src/value.rs:222:9
    |
222 | /         match *self {
223 | |             Value::Nil => true,
224 | |             _ => false,
225 | |         }
    | |_________^ help: try this: `matches!(*self, Value::Nil)`
    |
note: the lint level is defined here
   --> src/lib.rs:25:9
    |
25  | #![warn(clippy::all, clippy::pedantic, clippy::nursery)]
    |         ^^^^^^^^^^^
    = note: `#[warn(clippy::match_like_matches_macro)]` implied by `#[warn(clippy::all)]`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro
warning: this could be a `const fn`
  --> src/bin.rs:70:5
   |
70 | /     pub fn is_all(&self) -> bool {
71 | |         match *self {
72 | |             Bins::All => true,
73 | |             _ => false,
74 | |         }
75 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
warning: match expression looks like `matches!` macro
  --> src/bin.rs:71:9
   |
71 | /         match *self {
72 | |             Bins::All => true,
73 | |             _ => false,
74 | |         }
   | |_________^ help: try this: `matches!(*self, Bins::All)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro
warning: this could be a `const fn`
  --> src/bin.rs:78:5
   |
78 | /     pub fn is_none(&self) -> bool {
79 | |         match *self {
80 | |             Bins::None => true,
81 | |             _ => false,
82 | |         }
83 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
warning: match expression looks like `matches!` macro
  --> src/bin.rs:79:9
   |
79 | /         match *self {
80 | |             Bins::None => true,
81 | |             _ => false,
82 | |         }
   | |_________^ help: try this: `matches!(*self, Bins::None)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro
warning: redundant closure found
   --> src/batch/batch_executor.rs:102:44
    |
102 |             map.entry(node).or_insert_with(|| vec![]).push(idx);
    |                                            ^^^^^^^^^ help: remove closure as shown: `$crate::vec::Vec::new`
    |
note: the lint level is defined here
   --> src/lib.rs:25:9
    |
25  | #![warn(clippy::all, clippy::pedantic, clippy::nursery)]
    |         ^^^^^^^^^^^
    = note: `#[warn(clippy::redundant_closure)]` implied by `#[warn(clippy::all)]`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
warning: this could be a `const fn`
   --> src/cluster/node.rs:139:5
    |
139 | /     fn services_name(&self) -> &'static str {
140 | |         if self.client_policy.use_services_alternate {
141 | |             "services-alternate"
142 | |         } else {
143 | |             "services"
144 | |         }
145 | |     }
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
warning: comparison to empty slice
   --> src/cluster/node.rs:196:36
    |
196 |             Some(friend_string) if friend_string == "" => return Ok(friends),
    |                                    ^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `friend_string.is_empty()`
    |
note: the lint level is defined here
   --> src/lib.rs:25:9
    |
25  | #![warn(clippy::all, clippy::pedantic, clippy::nursery)]
    |         ^^^^^^^^^^^
    = note: `#[warn(clippy::comparison_to_empty)]` implied by `#[warn(clippy::all)]`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty
warning: using `Result.or_else(|x| Err(y))`, which is more succinctly expressed as `map_err(|x| y)`
   --> src/cluster/node.rs:290:9
    |
290 | /         Message::info(&mut conn, commands).or_else(|e| {
291 | |             conn.invalidate();
292 | |             Err(e)
293 | |         })
    | |__________^
    |
note: the lint level is defined here
   --> src/lib.rs:25:9
    |
25  | #![warn(clippy::all, clippy::pedantic, clippy::nursery)]
    |         ^^^^^^^^^^^
    = note: `#[warn(clippy::bind_instead_of_map)]` implied by `#[warn(clippy::all)]`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bind_instead_of_map
help: try this
    |
290 |         Message::info(&mut conn, commands).map_err(|e| {
291 |             conn.invalidate();
292 |             e
    |
warning: using `Result.or_else(|x| Err(y))`, which is more succinctly expressed as `map_err(|x| y)`
   --> src/cluster/mod.rs:249:22
    |
249 |           let tokens = PartitionTokenizer::new(&mut conn).or_else(|e| {
    |  ______________________^
250 | |             conn.invalidate();
251 | |             Err(e)
252 | |         })?;
    | |__________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bind_instead_of_map
help: try this
    |
249 |         let tokens = PartitionTokenizer::new(&mut conn).map_err(|e| {
250 |             conn.invalidate();
251 |             e
    |
warning: wildcard match will miss any future added variants
   --> src/cluster/mod.rs:324:17
    |
324 |                 _ => {
    |                 ^ help: try this: `std::prelude::v1::Err(..)`
    |
note: the lint level is defined here
   --> src/lib.rs:25:22
    |
25  | #![warn(clippy::all, clippy::pedantic, clippy::nursery)]
    |                      ^^^^^^^^^^^^^^^^
    = note: `#[warn(clippy::match_wildcard_for_single_variants)]` implied by `#[warn(clippy::pedantic)]`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_wildcard_for_single_variants
warning: wildcard match will miss any future added variants
  --> src/commands/batch_read_command.rs:93:17
   |
93 |                 _ => continue, // Node is currently inactive. Retry.
   |                 ^ help: try this: `std::prelude::v1::Err(..)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_wildcard_for_single_variants
warning: match expression looks like `matches!` macro
   --> src/commands/buffer.rs:511:27
    |
511 |               let each_op = match operation.data {
    |  ___________________________^
512 | |                 OperationData::CdtMapOp(_) | OperationData::CdtBitOp(_) => true,
513 | |                 _ => false,
514 | |             };
    | |_____________^ help: try this: `matches!(operation.data, OperationData::CdtMapOp(_) | OperationData::CdtBitOp(_))`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro
warning: comparison to empty slice
   --> src/commands/buffer.rs:606:12
    |
606 |         if namespace != "" {
    |            ^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!namespace.is_empty()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty
warning: comparison to empty slice
   --> src/commands/buffer.rs:611:12
    |
611 |         if set_name != "" {
    |            ^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!set_name.is_empty()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty
warning: comparison to empty slice
   --> src/commands/buffer.rs:653:12
    |
653 |         if namespace != "" {
    |            ^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!namespace.is_empty()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty
warning: comparison to empty slice
   --> src/commands/buffer.rs:657:12
    |
657 |         if set_name != "" {
    |            ^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!set_name.is_empty()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty
warning: comparison to empty slice
   --> src/commands/buffer.rs:712:12
    |
712 |         if statement.namespace != "" {
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!statement.namespace.is_empty()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty
warning: comparison to empty slice
   --> src/commands/buffer.rs:717:12
    |
717 |         if statement.set_name != "" {
    |            ^^^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!statement.set_name.is_empty()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty
warning: comparison to empty slice
   --> src/commands/buffer.rs:723:16
    |
723 |             if index_name != "" {
    |                ^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!index_name.is_empty()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty
warning: comparison to empty slice
   --> src/commands/buffer.rs:810:12
    |
810 |         if statement.namespace != "" {
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!statement.namespace.is_empty()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty
warning: comparison to empty slice
   --> src/commands/buffer.rs:820:12
    |
820 |         if statement.set_name != "" {
    |            ^^^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!statement.set_name.is_empty()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty
warning: comparison to empty slice
   --> src/commands/buffer.rs:905:12
    |
905 |         if key.namespace != "" {
    |            ^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!key.namespace.is_empty()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty
warning: comparison to empty slice
   --> src/commands/buffer.rs:910:12
    |
910 |         if key.set_name != "" {
    |            ^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!key.set_name.is_empty()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty
warning: comparison to empty slice
    --> src/commands/buffer.rs:1073:12
     |
1073 |         if key.namespace != "" {
     |            ^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!key.namespace.is_empty()`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty
warning: comparison to empty slice
    --> src/commands/buffer.rs:1077:12
     |
1077 |         if key.set_name != "" {
     |            ^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!key.set_name.is_empty()`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty
warning: use Option::map_or_else instead of an if let/else
    --> src/commands/buffer.rs:1196:9
     |
1196 | /         if let Some(pos) = pos {
1197 | |             Ok(self.data_buffer[pos])
1198 | |         } else {
1199 | |             let res = self.data_buffer[self.data_offset];
1200 | |             self.data_offset += 1;
1201 | |             Ok(res)
1202 | |         }
     | |_________^
     |
note: the lint level is defined here
    --> src/lib.rs:25:22
     |
25   | #![warn(clippy::all, clippy::pedantic, clippy::nursery)]
     |                      ^^^^^^^^^^^^^^^^
     = note: `#[warn(clippy::option_if_let_else)]` implied by `#[warn(clippy::pedantic)]`
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_if_let_else
help: try
     |
1196 |         pos.map_or_else(|| {
1197 |             let res = self.data_buffer[self.data_offset];
1198 |             self.data_offset += 1;
1199 |             Ok(res)
1200 |         }, |pos| Ok(self.data_buffer[pos]))
     |
warning: use Option::map_or_else instead of an if let/else
    --> src/commands/buffer.rs:1206:9
     |
1206 | /         if let Some(pos) = pos {
1207 | |             Ok(self.data_buffer[pos] as i8)
1208 | |         } else {
1209 | |             let res = self.data_buffer[self.data_offset] as i8;
1210 | |             self.data_offset += 1;
1211 | |             Ok(res)
1212 | |         }
     | |_________^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_if_let_else
help: try
     |
1206 |         pos.map_or_else(|| {
1207 |             let res = self.data_buffer[self.data_offset] as i8;
1208 |             self.data_offset += 1;
1209 |             Ok(res)
1210 |         }, |pos| Ok(self.data_buffer[pos] as i8))
     |
warning: use Option::map_or_else instead of an if let/else
    --> src/commands/buffer.rs:1217:9
     |
1217 | /         if let Some(pos) = pos {
1218 | |             Ok(NetworkEndian::read_u16(&self.data_buffer[pos..pos + len]))
1219 | |         } else {
1220 | |             let res = NetworkEndian::read_u16(
...    |
1224 | |             Ok(res)
1225 | |         }
     | |_________^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_if_let_else
help: try
     |
1217 |         pos.map_or_else(|| {
1218 |             let res = NetworkEndian::read_u16(
1219 |                 &self.data_buffer[self.data_offset..self.data_offset + len],
1220 |             );
1221 |             self.data_offset += len;
1222 |             Ok(res)
   ...
warning: use Option::map_or_else instead of an if let/else
    --> src/commands/buffer.rs:1235:9
     |
1235 | /         if let Some(pos) = pos {
1236 | |             Ok(NetworkEndian::read_u32(&self.data_buffer[pos..pos + len]))
1237 | |         } else {
1238 | |             let res = NetworkEndian::read_u32(
...    |
1242 | |             Ok(res)
1243 | |         }
     | |_________^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_if_let_else
help: try
     |
1235 |         pos.map_or_else(|| {
1236 |             let res = NetworkEndian::read_u32(
1237 |                 &self.data_buffer[self.data_offset..self.data_offset + len],
1238 |             );
1239 |             self.data_offset += len;
1240 |             Ok(res)
   ...
warning: use Option::map_or_else instead of an if let/else
    --> src/commands/buffer.rs:1253:9
     |
1253 | /         if let Some(pos) = pos {
1254 | |             Ok(NetworkEndian::read_u64(&self.data_buffer[pos..pos + len]))
1255 | |         } else {
1256 | |             let res = NetworkEndian::read_u64(
...    |
1260 | |             Ok(res)
1261 | |         }
     | |_________^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_if_let_else
help: try
     |
1253 |         pos.map_or_else(|| {
1254 |             let res = NetworkEndian::read_u64(
1255 |                 &self.data_buffer[self.data_offset..self.data_offset + len],
1256 |             );
1257 |             self.data_offset += len;
1258 |             Ok(res)
   ...
warning: use Option::map_or_else instead of an if let/else
    --> src/commands/buffer.rs:1277:9
     |
1277 | /         if let Some(pos) = pos {
1278 | |             Ok(NetworkEndian::read_f32(&self.data_buffer[pos..pos + len]))
1279 | |         } else {
1280 | |             let res = NetworkEndian::read_f32(
...    |
1284 | |             Ok(res)
1285 | |         }
     | |_________^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_if_let_else
help: try
     |
1277 |         pos.map_or_else(|| {
1278 |             let res = NetworkEndian::read_f32(
1279 |                 &self.data_buffer[self.data_offset..self.data_offset + len],
1280 |             );
1281 |             self.data_offset += len;
1282 |             Ok(res)
   ...
warning: use Option::map_or_else instead of an if let/else
    --> src/commands/buffer.rs:1290:9
     |
1290 | /         if let Some(pos) = pos {
1291 | |             Ok(NetworkEndian::read_f64(&self.data_buffer[pos..pos + len]))
1292 | |         } else {
1293 | |             let res = NetworkEndian::read_f64(
...    |
1297 | |             Ok(res)
1298 | |         }
     | |_________^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_if_let_else
help: try
     |
1290 |         pos.map_or_else(|| {
1291 |             let res = NetworkEndian::read_f64(
1292 |                 &self.data_buffer[self.data_offset..self.data_offset + len],
1293 |             );
1294 |             self.data_offset += len;
1295 |             Ok(res)
   ...
warning: `self.write_u8(0)?` is being shadowed
    --> src/commands/buffer.rs:1407:9
     |
1407 |         self.write_u8(0)?;
     |         ^^^^^^^^^^^^^^^^^
     |
note: the lint level is defined here
    --> src/lib.rs:25:22
     |
25   | #![warn(clippy::all, clippy::pedantic, clippy::nursery)]
     |                      ^^^^^^^^^^^^^^^^
     = note: `#[warn(clippy::shadow_unrelated)]` implied by `#[warn(clippy::pedantic)]`
note: initialization happens here
    --> src/commands/buffer.rs:1407:9
     |
1407 |         self.write_u8(0)?;
     |         ^^^^^^^^^^^^^^^^^
note: previous binding is here
    --> src/commands/buffer.rs:1406:33
     |
1406 |     pub fn write_geo(&mut self, val: &str) -> Result<usize> {
     |                                 ^^^
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#shadow_unrelated
warning: `self.write_u8(0)?` is being shadowed
    --> src/commands/buffer.rs:1408:9
     |
1408 |         self.write_u8(0)?;
     |         ^^^^^^^^^^^^^^^^^
     |
note: initialization happens here
    --> src/commands/buffer.rs:1408:9
     |
1408 |         self.write_u8(0)?;
     |         ^^^^^^^^^^^^^^^^^
note: previous binding is here
    --> src/commands/buffer.rs:1407:9
     |
1407 |         self.write_u8(0)?;
     |         ^^^^^^^^^^^^^^^^^
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#shadow_unrelated
warning: `self.write_u8(0)?` is being shadowed
    --> src/commands/buffer.rs:1409:9
     |
1409 |         self.write_u8(0)?;
     |         ^^^^^^^^^^^^^^^^^
     |
note: initialization happens here
    --> src/commands/buffer.rs:1409:9
     |
1409 |         self.write_u8(0)?;
     |         ^^^^^^^^^^^^^^^^^
note: previous binding is here
    --> src/commands/buffer.rs:1408:9
     |
1408 |         self.write_u8(0)?;
     |         ^^^^^^^^^^^^^^^^^
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#shadow_unrelated
warning: wildcard match will miss any future added variants
   --> src/commands/single_command.rs:103:17
    |
103 |                 _ => continue, // Node is currently inactive. Retry.
    |                 ^ help: try this: `std::prelude::v1::Err(..)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_wildcard_for_single_variants
warning: this could be a `const fn`
  --> src/commands/mod.rs:66:1
   |
66 | / pub fn keep_connection(err: &Error) -> bool {
67 | |     match *err {
68 | |         Error(ErrorKind::ServerError(result_code), _) => match result_code {
69 | |             ResultCode::KeyNotFoundError => true,
...  |
73 | |     }
74 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
warning: match expression looks like `matches!` macro
  --> src/commands/mod.rs:68:58
   |
68 |           Error(ErrorKind::ServerError(result_code), _) => match result_code {
   |  __________________________________________________________^
69 | |             ResultCode::KeyNotFoundError => true,
70 | |             _ => false,
71 | |         },
   | |_________^ help: try this: `matches!(result_code, ResultCode::KeyNotFoundError)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro
warning: this could be a `const fn`
   --> src/expressions/lists.rs:690:1
    |
690 | / fn get_value_type(return_type: ListReturnType) -> ExpType {
691 | |     if (return_type as u8 & !(ListReturnType::Inverted as u8)) == ListReturnType::Values as u8 {
692 | |         ExpType::LIST
693 | |     } else {
694 | |         ExpType::INT
695 | |     }
696 | | }
    | |_^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
warning: this could be a `const fn`
   --> src/expressions/maps.rs:833:1
    |
833 | / fn get_value_type(return_type: MapReturnType) -> ExpType {
834 | |     let t = return_type as u8 & !(MapReturnType::Inverted as u8);
835 | |     if t == MapReturnType::Key as u8 || t == MapReturnType::Value as u8 {
836 | |         ExpType::LIST
...   |
841 | |     }
842 | | }
    | |_^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
warning: use Option::map_or instead of an if let/else
   --> src/expressions/mod.rs:129:9
    |
129 | /         if let Some(bin) = bin {
130 | |             FilterExpression {
131 | |                 cmd,
132 | |                 val,
...   |
148 | |             }
149 | |         }
    | |_________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_if_let_else
help: try
    |
129 |         bin.map_or(FilterExpression {
130 |                 cmd,
131 |                 val,
132 |                 bin: None,
133 |                 flags,
134 |                 module,
  ...
warning: parameter of type `HashMap` should be generalized over different hashers
   --> src/expressions/mod.rs:666:21
    |
666 | pub fn map_val(val: HashMap<Value, Value>) -> FilterExpression {
    |                     ^^^^^^^^^^^^^^^^^^^^^
    |
note: the lint level is defined here
   --> src/lib.rs:25:22
    |
25  | #![warn(clippy::all, clippy::pedantic, clippy::nursery)]
    |                      ^^^^^^^^^^^^^^^^
    = note: `#[warn(clippy::implicit_hasher)]` implied by `#[warn(clippy::pedantic)]`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#implicit_hasher
help: consider adding a type parameter
    |
666 | pub fn map_val<S: ::std::hash::BuildHasher>(val: HashMap<Value, Value, S>) -> FilterExpression {
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^      ^^^^^^^^^^^^^^^^^^^^^^^^
warning: this could be a `const fn`
   --> src/expressions/mod.rs:703:1
    |
703 | / pub fn and(exps: Vec<FilterExpression>) -> FilterExpression {
704 | |     FilterExpression {
705 | |         cmd: Some(ExpOp::And),
706 | |         val: None,
...   |
712 | |     }
713 | | }
    | |_^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
warning: this could be a `const fn`
   --> src/expressions/mod.rs:721:1
    |
721 | / pub fn or(exps: Vec<FilterExpression>) -> FilterExpression {
722 | |     FilterExpression {
723 | |         cmd: Some(ExpOp::Or),
724 | |         val: None,
...   |
730 | |     }
731 | | }
    | |_^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
warning: this could be a `const fn`
   --> src/msgpack/decoder.rs:222:1
    |
222 | / fn is_ext(byte: u8) -> bool {
223 | |     match byte {
224 | |         0xc7 | 0xc8 | 0xc9 | 0xd4 | 0xd5 | 0xd6 | 0xd7 | 0xd8 => true,
225 | |         _ => false,
226 | |     }
227 | | }
    | |_^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
warning: match expression looks like `matches!` macro
   --> src/msgpack/decoder.rs:223:5
    |
223 | /     match byte {
224 | |         0xc7 | 0xc8 | 0xc9 | 0xd4 | 0xd5 | 0xd6 | 0xd7 | 0xd8 => true,
225 | |         _ => false,
226 | |     }
    | |_____^ help: try this: `matches!(byte, 0xc7 | 0xc8 | 0xc9 | 0xd4 | 0xd5 | 0xd6 | 0xd7 | 0xd8)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro
warning: `buf.write_u8(marker)?` is being shadowed
   --> src/msgpack/encoder.rs:227:9
    |
227 |         buf.write_u8(marker)?;
    |         ^^^^^^^^^^^^^^^^^^^^^
    |
note: initialization happens here
   --> src/msgpack/encoder.rs:227:9
    |
227 |         buf.write_u8(marker)?;
    |         ^^^^^^^^^^^^^^^^^^^^^
note: previous binding is here
   --> src/msgpack/encoder.rs:225:61
    |
225 | pub fn pack_byte(buf: &mut Option<&mut Buffer>, marker: u8, val: u8) -> Result<usize> {
    |                                                             ^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#shadow_unrelated
warning: `buf.write_u8(MSGPACK_MARKER_BOOL_TRUE)?` is being shadowed
   --> src/msgpack/encoder.rs:245:13
    |
245 |             buf.write_u8(MSGPACK_MARKER_BOOL_TRUE)?;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: initialization happens here
   --> src/msgpack/encoder.rs:245:13
    |
245 |             buf.write_u8(MSGPACK_MARKER_BOOL_TRUE)?;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: previous binding is here
   --> src/msgpack/encoder.rs:242:49
    |
242 | pub fn pack_bool(buf: &mut Option<&mut Buffer>, val: bool) -> Result<usize> {
    |                                                 ^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#shadow_unrelated
warning: `buf.write_u8(MSGPACK_MARKER_BOOL_FALSE)?` is being shadowed
   --> src/msgpack/encoder.rs:247:13
    |
247 |             buf.write_u8(MSGPACK_MARKER_BOOL_FALSE)?;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: initialization happens here
   --> src/msgpack/encoder.rs:247:13
    |
247 |             buf.write_u8(MSGPACK_MARKER_BOOL_FALSE)?;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: previous binding is here
   --> src/msgpack/encoder.rs:245:13
    |
245 |             buf.write_u8(MSGPACK_MARKER_BOOL_TRUE)?;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#shadow_unrelated
warning: manual `Range::contains` implementation
   --> src/msgpack/encoder.rs:257:16
    |
257 |         val if val >= 16 && val < 2 ^ 16 => pack_i16(buf, 0xde, length as i16),
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `(16..2 ^ 16).contains(&val)`
    |
note: the lint level is defined here
   --> src/lib.rs:25:9
    |
25  | #![warn(clippy::all, clippy::pedantic, clippy::nursery)]
    |         ^^^^^^^^^^^
    = note: `#[warn(clippy::manual_range_contains)]` implied by `#[warn(clippy::all)]`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains
warning: manual `Range::contains` implementation
   --> src/msgpack/encoder.rs:266:16
    |
266 |         val if val >= 16 && val < 2 ^ 16 => pack_i16(buf, 0xdc, length as i16),
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `(16..2 ^ 16).contains(&val)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains
warning: `buf.write_u8(ParticleType::BLOB as u8)?` is being shadowed
   --> src/msgpack/encoder.rs:286:9
    |
286 |         buf.write_u8(ParticleType::BLOB as u8)?;
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: initialization happens here
   --> src/msgpack/encoder.rs:286:9
    |
286 |         buf.write_u8(ParticleType::BLOB as u8)?;
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: previous binding is here
   --> src/msgpack/encoder.rs:281:49
    |
281 | pub fn pack_blob(buf: &mut Option<&mut Buffer>, val: &[u8]) -> Result<usize> {
    |                                                 ^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#shadow_unrelated
warning: `buf.write_u8(ParticleType::STRING as u8)?` is being shadowed
   --> src/msgpack/encoder.rs:299:9
    |
299 |         buf.write_u8(ParticleType::STRING as u8)?;
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: initialization happens here
   --> src/msgpack/encoder.rs:299:9
    |
299 |         buf.write_u8(ParticleType::STRING as u8)?;
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: previous binding is here
   --> src/msgpack/encoder.rs:294:51
    |
294 | pub fn pack_string(buf: &mut Option<&mut Buffer>, val: &str) -> Result<usize> {
    |                                                   ^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#shadow_unrelated
warning: `buf.write_u8(ParticleType::GEOJSON as u8)?` is being shadowed
   --> src/msgpack/encoder.rs:324:9
    |
324 |         buf.write_u8(ParticleType::GEOJSON as u8)?;
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: initialization happens here
   --> src/msgpack/encoder.rs:324:9
    |
324 |         buf.write_u8(ParticleType::GEOJSON as u8)?;
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: previous binding is here
   --> src/msgpack/encoder.rs:319:49
    |
319 | fn pack_geo_json(buf: &mut Option<&mut Buffer>, val: &str) -> Result<usize> {
    |                                                 ^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#shadow_unrelated
warning: manual `Range::contains` implementation
   --> src/msgpack/encoder.rs:334:16
    |
334 |         val if val >= 0 && val < 2 ^ 7 => pack_half_byte(buf, val as u8),
    |                ^^^^^^^^^^^^^^^^^^^^^^^ help: use: `(0..2 ^ 7).contains(&val)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains
warning: `buf.write_u8(marker)?` is being shadowed
   --> src/msgpack/encoder.rs:367:9
    |
367 |         buf.write_u8(marker)?;
    |         ^^^^^^^^^^^^^^^^^^^^^
    |
note: initialization happens here
   --> src/msgpack/encoder.rs:367:9
    |
367 |         buf.write_u8(marker)?;
    |         ^^^^^^^^^^^^^^^^^^^^^
note: previous binding is here
   --> src/msgpack/encoder.rs:365:60
    |
365 | pub fn pack_i16(buf: &mut Option<&mut Buffer>, marker: u8, val: i16) -> Result<usize> {
    |                                                            ^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#shadow_unrelated
warning: `buf.write_u8(marker)?` is being shadowed
   --> src/msgpack/encoder.rs:376:9
    |
376 |         buf.write_u8(marker)?;
    |         ^^^^^^^^^^^^^^^^^^^^^
    |
note: initialization happens here
   --> src/msgpack/encoder.rs:376:9
    |
376 |         buf.write_u8(marker)?;
    |         ^^^^^^^^^^^^^^^^^^^^^
note: previous binding is here
   --> src/msgpack/encoder.rs:374:60
    |
374 | pub fn pack_i32(buf: &mut Option<&mut Buffer>, marker: u8, val: i32) -> Result<usize> {
    |                                                            ^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#shadow_unrelated
warning: `buf.write_u8(marker)?` is being shadowed
   --> src/msgpack/encoder.rs:385:9
    |
385 |         buf.write_u8(marker)?;
    |         ^^^^^^^^^^^^^^^^^^^^^
    |
note: initialization happens here
   --> src/msgpack/encoder.rs:385:9
    |
385 |         buf.write_u8(marker)?;
    |         ^^^^^^^^^^^^^^^^^^^^^
note: previous binding is here
   --> src/msgpack/encoder.rs:383:60
    |
383 | pub fn pack_i64(buf: &mut Option<&mut Buffer>, marker: u8, val: i64) -> Result<usize> {
    |                                                            ^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#shadow_unrelated
warning: `buf.write_u8(0xcf)?` is being shadowed
   --> src/msgpack/encoder.rs:398:9
    |
398 |         buf.write_u8(0xcf)?;
    |         ^^^^^^^^^^^^^^^^^^^
    |
note: initialization happens here
   --> src/msgpack/encoder.rs:398:9
    |
398 |         buf.write_u8(0xcf)?;
    |         ^^^^^^^^^^^^^^^^^^^
note: previous binding is here
   --> src/msgpack/encoder.rs:392:48
    |
392 | pub fn pack_u64(buf: &mut Option<&mut Buffer>, val: u64) -> Result<usize> {
    |                                                ^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#shadow_unrelated
warning: `buf.write_u8(0xca)?` is being shadowed
   --> src/msgpack/encoder.rs:407:9
    |
407 |         buf.write_u8(0xca)?;
    |         ^^^^^^^^^^^^^^^^^^^
    |
note: initialization happens here
   --> src/msgpack/encoder.rs:407:9
    |
407 |         buf.write_u8(0xca)?;
    |         ^^^^^^^^^^^^^^^^^^^
note: previous binding is here
   --> src/msgpack/encoder.rs:405:48
    |
405 | pub fn pack_f32(buf: &mut Option<&mut Buffer>, val: f32) -> Result<usize> {
    |                                                ^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#shadow_unrelated
warning: `buf.write_u8(0xcb)?` is being shadowed
   --> src/msgpack/encoder.rs:416:9
    |
416 |         buf.write_u8(0xcb)?;
    |         ^^^^^^^^^^^^^^^^^^^
    |
note: initialization happens here
   --> src/msgpack/encoder.rs:416:9
    |
416 |         buf.write_u8(0xcb)?;
    |         ^^^^^^^^^^^^^^^^^^^
note: previous binding is here
   --> src/msgpack/encoder.rs:414:48
    |
414 | pub fn pack_f64(buf: &mut Option<&mut Buffer>, val: f64) -> Result<usize> {
    |                                                ^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#shadow_unrelated
warning: use Option::map_or instead of an if let/else
   --> src/net/connection.rs:100:9
    |
100 | /         if let Some(idle_dl) = self.idle_deadline {
101 | |             Instant::now() >= idle_dl
102 | |         } else {
103 | |             false
104 | |         }
    | |_________^ help: try: `self.idle_deadline.map_or(false, |idle_dl| Instant::now() >= idle_dl)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_if_let_else
warning: using `Result.or_else(|x| Err(y))`, which is more succinctly expressed as `map_err(|x| y)`
  --> src/net/connection_pool.rs:86:9
   |
86 | /         connection.set_timeout(timeout).or_else(|err| {
87 | |             internals.num_conns -= 1;
88 | |             Err(err)
89 | |         })?;
   | |__________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bind_instead_of_map
help: try this
   |
86 |         connection.set_timeout(timeout).map_err(|err| {
87 |             internals.num_conns -= 1;
88 |             err
   |
warning: this could be a `const fn`
   --> src/operations/lists.rs:177:1
    |
177 | / pub fn list_order_flag(order: ListOrderType, pad: bool) -> u8 {
178 | |     if let ListOrderType::Ordered = order {
179 | |         return 0xc0;
180 | |     }
...   |
184 | |     0x40
185 | | }
    | |_^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
warning: this could be a `const fn`
   --> src/operations/maps.rs:195:1
    |
195 | / pub(crate) fn map_write_op(policy: &MapPolicy, multi: bool) -> CdtMapOpType {
196 | |     match policy.write_mode {
197 | |         MapWriteMode::Update => {
198 | |             if multi {
...   |
218 | |     }
219 | | }
    | |_^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
warning: this could be a `const fn`
   --> src/operations/maps.rs:221:1
    |
221 | / fn map_order_arg(policy: &MapPolicy) -> Option<CdtArgument> {
222 | |     match policy.write_mode {
223 | |         MapWriteMode::UpdateOnly => None,
224 | |         _ => Some(CdtArgument::Byte(policy.order as u8)),
225 | |     }
226 | | }
    | |_^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
warning: this could be a `const fn`
  --> src/operations/scalar.rs:43:1
   |
43 | / pub fn get_bin(bin_name: &str) -> Operation {
44 | |     Operation {
45 | |         op: OperationType::Read,
46 | |         ctx: DEFAULT_CTX,
...  |
49 | |     }
50 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
warning: this could be a `const fn`
  --> src/operations/scalar.rs:53:1
   |
53 | / pub fn put<'a>(bin: &'a Bin) -> Operation<'a> {
54 | |     Operation {
55 | |         op: OperationType::Write,
56 | |         ctx: DEFAULT_CTX,
...  |
59 | |     }
60 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
warning: this could be a `const fn`
  --> src/operations/scalar.rs:63:1
   |
63 | / pub fn append<'a>(bin: &'a Bin) -> Operation<'a> {
64 | |     Operation {
65 | |         op: OperationType::Append,
66 | |         ctx: DEFAULT_CTX,
...  |
69 | |     }
70 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
warning: this could be a `const fn`
  --> src/operations/scalar.rs:73:1
   |
73 | / pub fn prepend<'a>(bin: &'a Bin) -> Operation<'a> {
74 | |     Operation {
75 | |         op: OperationType::Prepend,
76 | |         ctx: DEFAULT_CTX,
...  |
79 | |     }
80 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
warning: this could be a `const fn`
  --> src/operations/scalar.rs:83:1
   |
83 | / pub fn add<'a>(bin: &'a Bin) -> Operation<'a> {
84 | |     Operation {
85 | |         op: OperationType::Incr,
86 | |         ctx: DEFAULT_CTX,
...  |
89 | |     }
90 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
warning: field assignment outside of initializer for an instance created with Default::default()
  --> src/policy/write_policy.rs:75:9
   |
75 |         wp.generation = gen;
   |         ^^^^^^^^^^^^^^^^^^^^
   |
note: the lint level is defined here
  --> src/lib.rs:25:9
   |
25 | #![warn(clippy::all, clippy::pedantic, clippy::nursery)]
   |         ^^^^^^^^^^^
   = note: `#[warn(clippy::field_reassign_with_default)]` implied by `#[warn(clippy::all)]`
note: consider initializing the variable with `policy::write_policy::WritePolicy { generation: gen, expiration: exp, ..Default::default() }` and removing relevant reassignments
  --> src/policy/write_policy.rs:74:9
   |
74 |         let mut wp = WritePolicy::default();
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
warning: wildcard match will miss any future added variants
  --> src/record.rs:77:21
   |
77 |                     _ => Some(Duration::new(1u64, 0)),
   |                     ^ help: try this: `std::prelude::v1::Err(..)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_wildcard_for_single_variants
warning: this could be a `const fn`
   --> src/result_code.rs:216:5
    |
216 | /     pub fn from_u8(n: u8) -> ResultCode {
217 | |         match n {
218 | |             0 => ResultCode::Ok,
219 | |             1 => ResultCode::ServerError,
...   |
281 | |         }
282 | |     }
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
warning: 76 warnings emitted
Metadata
Metadata
Assignees
Labels
No labels