Skip to content

Commit ed966ab

Browse files
committed
chore: fix linting
1 parent 6058ddf commit ed966ab

8 files changed

Lines changed: 1167 additions & 689 deletions

File tree

Cargo.lock

Lines changed: 1138 additions & 669 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cli/cmd/dataset.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,12 @@ pub enum DepositCommand {
3333
}
3434

3535
impl Input {
36-
pub async fn exec(&self, ctx: Context) -> Result<(), Error> {
36+
pub async fn exec(&self, _ctx: Context) -> Result<(), Error> {
3737
match self.subcmd {
38-
DatasetCommand::Deposit { cmd: _ } => Ok(print!("Hi")),
38+
DatasetCommand::Deposit { cmd: _ } => {
39+
print!("Hi");
40+
Ok(())
41+
}
3942
}
4043
}
4144
}

src/cli/cmd/dataset/deposit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::env::VarError;
66
use std::path::PathBuf;
77

88
#[derive(Debug, Clone, ValueEnum)]
9-
enum Provider {
9+
pub enum Provider {
1010
Zenodo,
1111
}
1212

src/cli/cmd/dataset/zenodo.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use walkdir::WalkDir;
1010

1111
use std::io;
1212
use std::sync::LazyLock;
13+
1314
pub struct ZenodoClient {
1415
http_client: reqwest::Client,
1516
base_url: Url,
@@ -38,15 +39,15 @@ pub enum Error {
3839
impl ZenodoClient {
3940
pub fn new(token: String) -> ZenodoClient {
4041
let http_client = reqwest::Client::new();
41-
return ZenodoClient {
42+
ZenodoClient {
4243
http_client,
4344
base_url: BASE_URL.clone(),
4445
token,
45-
};
46+
}
4647
}
4748

4849
fn make_url(&self, path: &str) -> Result<Url, Error> {
49-
return self.base_url.join(path).context(UrlParseSnafu);
50+
self.base_url.join(path).context(UrlParseSnafu)
5051
}
5152

5253
pub async fn get_deposition<R: DeserializeOwned>(
@@ -57,11 +58,12 @@ impl ZenodoClient {
5758
let res = self
5859
.http_client
5960
.get(endpoint)
61+
.bearer_auth(&self.token)
6062
.send()
6163
.await
6264
.context(ReqwestSnafu)?;
6365
// res.error_for_status().context(ReqwestSnafu)?;
64-
return res.json::<R>().await.context(DeserializeRespSnafu);
66+
res.json::<R>().await.context(DeserializeRespSnafu)
6567
}
6668

6769
pub async fn upload_files(&self, deposition_id: &str, source_path: &Path) -> Result<(), Error> {
@@ -77,11 +79,11 @@ impl ZenodoClient {
7779
let res = self
7880
.http_client
7981
.get(endpoint)
82+
.bearer_auth(&self.token)
8083
.send()
8184
.await
8285
.context(ReqwestSnafu)?;
83-
// res.error_for_status().context(ReqwestSnafu)?;
84-
return res.json::<R>().await.context(DeserializeRespSnafu);
86+
res.json::<R>().await.context(DeserializeRespSnafu)
8587
}
8688

8789
async fn upload_file<R: DeserializeOwned>(
@@ -114,11 +116,11 @@ impl ZenodoClient {
114116
let res = self
115117
.http_client
116118
.post(endpoint)
119+
.bearer_auth(&self.token)
117120
.multipart(form)
118121
.send()
119122
.await
120123
.context(ReqwestSnafu)?;
121-
// res.error_for_status().context(ReqwestSnafu)?;
122-
return res.json::<R>().await.context(DeserializeRespSnafu);
124+
res.json::<R>().await.context(DeserializeRespSnafu)
123125
}
124126
}

src/cli/cmd/login.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ use snafu::{ResultExt, Snafu};
1313
/// The login consists of two parts:
1414
///
1515
/// 1. Renku is queried to return a temporary URL that can be used to
16-
/// authenticate and authorize this application. The url must be
17-
/// opened with some device and the user code must be entered (if
18-
/// necessary).
16+
/// authenticate and authorize this application. The url must be
17+
/// opened with some device and the user code must be entered (if
18+
/// necessary).
1919
///
2020
/// 2. Once the first step is complete, the cli can obtain an access
21-
/// token and does so by periodically polling the renku platform.
21+
/// token and does so by periodically polling the renku platform.
2222
///
2323
/// The login command can do these two steps separately. This requires
2424
/// to run with `--user-code-only` to omit the second step and store
@@ -68,7 +68,7 @@ enum Steps<'a> {
6868
Complete,
6969
}
7070
impl Input {
71-
fn get_steps(&self) -> Steps {
71+
fn get_steps(&'_ self) -> Steps<'_> {
7272
if let Some(p) = &self.continue_from {
7373
Steps::Continue(p)
7474
} else if self.user_code_only {

src/cli/cmd/project/clone.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ impl Input {
114114
}
115115
}
116116

117-
async fn clone_project<'a>(
117+
async fn clone_project(
118118
ctx: Context,
119119
project: &ProjectDetails,
120120
target: PathBuf,

src/cli/cmd/version.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub struct Versions<'a> {
5656
pub renku_url: &'a str,
5757
}
5858
impl Versions<'_> {
59-
pub fn create(server: VersionInfo, renku_url: &str) -> Versions {
59+
pub fn create(server: VersionInfo, renku_url: &'_ str) -> Versions<'_> {
6060
Versions {
6161
client: BuildInfo::default(),
6262
server,

src/main.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ async fn execute() -> Result<()> {
3030

3131
let result = rnk::execute_cmd(opts).await;
3232
if remove_env {
33-
env::remove_var(LOG_LEVEL);
33+
unsafe {
34+
env::remove_var(LOG_LEVEL);
35+
}
3436
}
3537
result?;
3638
Ok(())
@@ -39,7 +41,9 @@ async fn execute() -> Result<()> {
3941
fn set_log_level(level: &str) -> bool {
4042
let current = env::var_os(LOG_LEVEL);
4143
if current.is_none() {
42-
env::set_var(LOG_LEVEL, level);
44+
unsafe {
45+
env::set_var(LOG_LEVEL, level);
46+
}
4347
true
4448
} else {
4549
false

0 commit comments

Comments
 (0)