Skip to content

Commit

Permalink
Fix warnings generated by clippy
Browse files Browse the repository at this point in the history
shvcall: Avoid redundant references in `send_request` arguments

Bypass clippy checks on uppercase constants in the chainpack module
and allow Access::from_str to return Option instead of Result as in
the definition of from_str in FromStr trait.
  • Loading branch information
j4r0u53k committed Mar 13, 2024
1 parent d55548d commit 4d77ef7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/bin/shvcall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ async fn make_call(url: &Url, opts: &Opts) -> Result {
match parse_line(line) {
Ok((path, method, param)) => {
let rqid =
send_request(&mut *frame_writer, &path, &method, &param)
send_request(&mut *frame_writer, path, method, param)
.await?;
loop {
let resp = frame_reader.receive_message().await?;
Expand Down
1 change: 1 addition & 0 deletions src/chainpack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::collections::BTreeMap;
use crate::reader::{Reader, ByteReader, ReadError, ReadErrorReason};
use crate::rpcvalue::{Map, IMap};

#[allow(clippy::upper_case_acronyms)]
#[warn(non_camel_case_types)]
#[allow(dead_code)]
pub(crate) enum PackingSchema {
Expand Down
2 changes: 2 additions & 0 deletions src/metamethod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ impl From<u8> for Flag {
#[derive(Debug, Copy, Clone, PartialEq, PartialOrd)]
pub enum Access { Browse = 0, Read, Write, Command, Config, Service, SuperService, Developer, Superuser }
impl Access {
// It makes sense to return Option rather than Result as the `FromStr` trait does.
#[allow(clippy::should_implement_trait)]
pub fn from_str(value: &str) -> Option<Self> {
match value {
"bws" => Some(Access::Browse),
Expand Down

0 comments on commit 4d77ef7

Please sign in to comment.