Skip to content

Commit af37918

Browse files
committed
chore: fmt and clippy
1 parent b5951f5 commit af37918

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

src/cli/src/cli.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -201,19 +201,19 @@ impl Cli {
201201

202202
url.set_host(Host::from(&options.host).url())
203203
.add_route(&options.owner);
204-
if let Some(repo) = args.get(0) {
204+
if let Some(repo) = args.first() {
205205
url.add_route(repo);
206206
}
207207

208208
CloneAction::new(&url.build())
209209
} else if args.len() == 1 {
210-
if let Some(url) = args.get(0) {
210+
if let Some(url) = args.first() {
211211
CloneAction::new(url)
212212
} else {
213213
return Err(Error::Devmode(DevmodeError::NoUrlProvided));
214214
}
215215
} else if args.len() == 3 {
216-
if let Some(host) = args.get(0) {
216+
if let Some(host) = args.first() {
217217
url.set_host(Host::from(host).url());
218218
}
219219
if let Some(owner) = args.get(1) {
@@ -251,7 +251,7 @@ impl Cli {
251251
let reader = create_paths_reader()?;
252252
let paths = find_paths(reader, project)?;
253253
if paths.is_empty() {
254-
return Err(Error::Devmode(DevmodeError::NoProjectFound));
254+
Err(Error::Devmode(DevmodeError::NoProjectFound))
255255
} else if paths.len() > 1 {
256256
let paths: Vec<&str> = paths.iter().map(|s| s as &str).collect();
257257
let path = select_repo(paths)?.to_string();
@@ -264,7 +264,7 @@ impl Cli {
264264
let reader = create_paths_reader()?;
265265
let paths = find_paths(reader, project)?;
266266
if paths.is_empty() {
267-
return Err(Error::Devmode(DevmodeError::NoProjectFound));
267+
Err(Error::Devmode(DevmodeError::NoProjectFound))
268268
} else if paths.len() > 1 {
269269
let paths: Vec<&str> = paths.iter().map(|s| s as &str).collect();
270270
let path = select_repo(paths)?;
@@ -277,19 +277,19 @@ impl Cli {
277277
fn fork(args: &[String], upstream: &str, rx: Regex) -> Result<(), Error> {
278278
let action = if args.is_empty() {
279279
fork_setup()?
280-
} else if rx.is_match(args.get(0).unwrap().as_bytes()) {
281-
ForkAction::parse_url(args.get(0).unwrap(), rx, upstream.to_string())?
280+
} else if rx.is_match(args.first().unwrap().as_bytes()) {
281+
ForkAction::parse_url(args.first().unwrap(), rx, upstream.to_string())?
282282
} else if args.len() == 1 {
283283
let options =
284284
Settings::current().ok_or(Error::Devmode(DevmodeError::AppSettingsNotFound))?;
285285
let host = Host::from(&options.host);
286286
let repo = args
287-
.get(0)
287+
.first()
288288
.map(|a| a.to_string())
289289
.ok_or(Error::Generic("Failed to get repo"))?;
290290
ForkAction::from(host, upstream.to_string(), options.owner, repo)
291291
} else {
292-
let host = Host::from(args.get(0).unwrap());
292+
let host = Host::from(args.first().unwrap());
293293
let owner = args
294294
.get(1)
295295
.map(|a| a.to_string())
@@ -349,7 +349,7 @@ impl Cli {
349349
for provider in fs::read_dir(dev)? {
350350
for user in fs::read_dir(provider?.path())? {
351351
let user = user?;
352-
for repo_or_workspace in fs::read_dir(&user.path())? {
352+
for repo_or_workspace in fs::read_dir(user.path())? {
353353
let repo_or_workspace = repo_or_workspace?;
354354
let repo_name =
355355
repo_or_workspace.file_name().to_str().unwrap().to_string();
@@ -360,7 +360,7 @@ impl Cli {
360360
let repo = repo?;
361361
fs_extra::dir::move_dir(
362362
repo.path(),
363-
&user.path(),
363+
user.path(),
364364
&Default::default(),
365365
)?;
366366
}
@@ -377,7 +377,7 @@ impl Cli {
377377
for provider in fs::read_dir(dev)? {
378378
for user in fs::read_dir(provider?.path())? {
379379
let user = user?;
380-
for repo_or_workspace in fs::read_dir(&user.path())? {
380+
for repo_or_workspace in fs::read_dir(user.path())? {
381381
let repo_or_workspace = repo_or_workspace?;
382382
let name =
383383
repo_or_workspace.file_name().to_str().unwrap().to_string();

src/cli/src/input.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ pub fn config_editor() -> Result<Settings, Error> {
150150
return devmode::error("Editor name is required.");
151151
}
152152
} else {
153-
Editor::new(Application::from(&*item.text))
153+
Editor::new(Application::from(&item.text))
154154
}
155155
}
156156
_ => return devmode::error("Editor must be picked."),

src/ui/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ mod pages;
1010
/// It takes two arguments:
1111
/// - `settings` is a structure that contains everything relevant with your app's configuration, such as antialiasing, themes, icons, etc...
1212
/// - `()` is the flags that your app needs to use before it starts.
13-
/// If your app does not need any flags, you can pass in `()`.
13+
/// If your app does not need any flags, you can pass in `()`.
1414
fn main() -> cosmic::iced::Result {
1515
let settings = cosmic::app::Settings::default();
1616
cosmic::app::run::<Devmode>(settings, ())

0 commit comments

Comments
 (0)