Skip to content

Commit 9dd090d

Browse files
authored
Fix clippy lint (#547)
1 parent 70f06d5 commit 9dd090d

File tree

9 files changed

+19
-19
lines changed

9 files changed

+19
-19
lines changed

src/subcommand/completions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ impl Completions {
4949
if self.shell_flag.is_some() || self.shell_positional.is_some() {
5050
let shell = xor_args(
5151
"shell_flag",
52-
&self.shell_flag,
52+
self.shell_flag.as_ref(),
5353
"shell_positional",
54-
&self.shell_positional,
54+
self.shell_positional.as_ref(),
5555
)?;
5656

5757
if let Some(dir) = self.dir {

src/subcommand/torrent/announce.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ impl Announce {
4040
pub(crate) fn run(self, env: &mut Env) -> Result<(), Error> {
4141
let target = xor_args(
4242
"input_flag",
43-
&self.input_flag,
43+
self.input_flag.as_ref(),
4444
"input_positional",
45-
&self.input_positional,
45+
self.input_positional.as_ref(),
4646
)?;
4747

4848
let input = env.read(target)?;

src/subcommand/torrent/create.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,9 @@ impl Create {
280280
pub(crate) fn run(self, env: &mut Env, options: &Options) -> Result<(), Error> {
281281
let input = xor_args(
282282
"input_positional",
283-
&self.input_positional,
283+
self.input_positional.as_ref(),
284284
"input_flag",
285-
&self.input_flag,
285+
self.input_flag.as_ref(),
286286
)?;
287287

288288
let mut linter = Linter::new();

src/subcommand/torrent/dump.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ impl Dump {
8585
pub(crate) fn run(self, env: &mut Env) -> Result<(), Error> {
8686
let target = xor_args(
8787
"input_positional",
88-
&self.input_positional,
88+
self.input_positional.as_ref(),
8989
"input_flag",
90-
&self.input_flag,
90+
self.input_flag.as_ref(),
9191
)?;
9292

9393
let input = env.read(target.clone())?;

src/subcommand/torrent/from_link.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ impl FromLink {
4848
pub(crate) fn run(self, env: &mut Env, options: &Options) -> Result<()> {
4949
let link = xor_args(
5050
"input_flag",
51-
&self.input_flag,
51+
self.input_flag.as_ref(),
5252
"input_positional",
53-
&self.input_positional,
53+
self.input_positional.as_ref(),
5454
)?;
5555

5656
let infohash = link.infohash;

src/subcommand/torrent/link.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ impl Link {
6363
pub(crate) fn run(self, env: &mut Env) -> Result<(), Error> {
6464
let input = xor_args(
6565
"input_flag",
66-
&self.input_flag,
66+
self.input_flag.as_ref(),
6767
"input_positional",
68-
&self.input_positional,
68+
self.input_positional.as_ref(),
6969
)?;
7070

7171
let input = env.read(input)?;

src/subcommand/torrent/show.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ impl Show {
5353
pub(crate) fn run(self, env: &mut Env) -> Result<(), Error> {
5454
let target = xor_args(
5555
"input_flag",
56-
&self.input_flag,
56+
self.input_flag.as_ref(),
5757
"input_positional",
58-
&self.input_positional,
58+
self.input_positional.as_ref(),
5959
)?;
6060

6161
let input = env.read(target)?;

src/subcommand/torrent/verify.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ impl Verify {
6565
pub(crate) fn run(self, env: &mut Env, options: &Options) -> Result<(), Error> {
6666
let target = xor_args(
6767
"input_positional",
68-
&self.input_positional,
68+
self.input_positional.as_ref(),
6969
"input_flag",
70-
&self.input_flag,
70+
self.input_flag.as_ref(),
7171
)?;
7272

7373
VerifyStep::Loading { metainfo: &target }.print(env)?;

src/xor_args.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ use crate::common::*;
22

33
pub(crate) fn xor_args<T: Clone>(
44
a_name: &str,
5-
a: &Option<T>,
5+
a: Option<&T>,
66
b_name: &str,
7-
b: &Option<T>,
7+
b: Option<&T>,
88
) -> Result<T> {
9-
let target = a.as_ref().xor(b.as_ref()).ok_or_else(|| {
9+
let target = a.xor(b).ok_or_else(|| {
1010
Error::internal(format!(
1111
"Expected exactly one of the arguments `{a_name}` or `{b_name}` to be set",
1212
))

0 commit comments

Comments
 (0)