Skip to content

Commit 9001559

Browse files
committed
chore: clippy
1 parent 60cf1ea commit 9001559

40 files changed

+170
-218
lines changed

build.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,10 @@ fn main() {
3333
Ok(output) => {
3434
let msg = String::from_utf8_lossy(&output.stdout).to_string();
3535
if let Err(err) = std::fs::write(install_dir.join("commit"), msg) {
36-
println!(
37-
"cargo:warning=failed to write current commit message: {}",
38-
err
39-
)
36+
println!("cargo:warning=failed to write current commit message: {err}")
4037
}
4138
}
42-
Err(err) => println!(
43-
"cargo:warning=failed to get current commit message: {}",
44-
err
45-
),
39+
Err(err) => println!("cargo:warning=failed to get current commit message: {err}"),
4640
}
4741

4842
// Copy templates

src/android/adb/device_list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ mod test {
9090
)]
9191
fn test_adb_output_regex(input: &str, devices: Vec<&'static str>) {
9292
let regex = regex_multi_line!(ADB_DEVICE_REGEX);
93-
println!("{}", input);
93+
println!("{input}");
9494
let captures = regex
9595
.captures_iter(input)
9696
.map(|x| x.get(1).unwrap().as_str())

src/android/cli.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,7 @@ impl Reportable for Error {
151151
Self::ProjectDirAbsent { project_dir } => Report::action_request(
152152
"Please run `cargo mobile init` and try again!",
153153
format!(
154-
"Android Studio project directory {:?} doesn't exist.",
155-
project_dir
154+
"Android Studio project directory {project_dir:?} doesn't exist."
156155
),
157156
),
158157
Self::OpenFailed(err) => Report::error("Failed to open project in Android Studio", err),

src/android/config.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,20 +145,15 @@ impl Display for ProjectDirInvalid {
145145
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
146146
match self {
147147
Self::NormalizationFailed { project_dir, cause } => {
148-
write!(f, "{:?} couldn't be normalized: {}", project_dir, cause)
148+
write!(f, "{project_dir:?} couldn't be normalized: {cause}")
149149
}
150150
Self::OutsideOfAppRoot {
151151
project_dir,
152152
root_dir,
153-
} => write!(
154-
f,
155-
"{:?} is outside of the app root {:?}",
156-
project_dir, root_dir,
157-
),
153+
} => write!(f, "{project_dir:?} is outside of the app root {root_dir:?}",),
158154
Self::ContainsSpaces { project_dir } => write!(
159155
f,
160-
"{:?} contains spaces, which the NDK is remarkably intolerant of",
161-
project_dir
156+
"{project_dir:?} contains spaces, which the NDK is remarkably intolerant of"
162157
),
163158
}
164159
}

src/android/jnilibs.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,16 @@ impl Reportable for RemoveBrokenLinksError {
3333
fn report(&self) -> Report {
3434
match self {
3535
Self::ReadDir { dir, source } => Report::error(
36-
format!("Failed to list contents of jniLibs directory {:?}", dir),
36+
format!("Failed to list contents of jniLibs directory {dir:?}"),
3737
source,
3838
),
3939
Self::Entry { dir, source } => Report::error(
40-
format!("Failed to get entry in jniLibs directory {:?}", dir),
41-
source,
42-
),
43-
Self::Remove { path, source } => Report::error(
44-
format!("Failed to remove broken symlink {:?}", path),
40+
format!("Failed to get entry in jniLibs directory {dir:?}"),
4541
source,
4642
),
43+
Self::Remove { path, source } => {
44+
Report::error(format!("Failed to remove broken symlink {path:?}"), source)
45+
}
4746
}
4847
}
4948
}

src/android/project.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ impl Reportable for Error {
6161
Report::error("Android template processing failed", err)
6262
}
6363
Self::DirectoryCreationFailed { path, cause } => Report::error(
64-
format!("Failed to create Android assets directory at {:?}", path),
64+
format!("Failed to create Android assets directory at {path:?}"),
6565
cause,
6666
),
6767
Self::DirectoryReadFailed { path, cause } => {
68-
Report::error(format!("Failed to read directory at {:?}", path), cause)
68+
Report::error(format!("Failed to read directory at {path:?}"), cause)
6969
}
7070
Self::DirectoryRemoveFailed { path, cause } => Report::error(
71-
format!("Failed to remove directory directory at {:?}", path),
71+
format!("Failed to remove directory directory at {path:?}"),
7272
cause,
7373
),
7474
Self::AssetDirSymlinkFailed(err) => {
@@ -77,12 +77,11 @@ impl Reportable for Error {
7777
Self::DotCargoGenFailed(err) => {
7878
Report::error("Failed to generate Android cargo config", err)
7979
}
80-
Self::FileCopyFailed { src, dest, cause } => Report::error(
81-
format!("Failed to copy file at {:?} to {:?}", src, dest),
82-
cause,
83-
),
80+
Self::FileCopyFailed { src, dest, cause } => {
81+
Report::error(format!("Failed to copy file at {src:?} to {dest:?}"), cause)
82+
}
8483
Self::AssetSourceInvalid(src) => Report::error(
85-
format!("Asset source at {:?} invalid", src),
84+
format!("Asset source at {src:?} invalid"),
8685
"Asset sources must be either a directory or a file",
8786
),
8887
}

src/android/source_props.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl Display for Revision {
3232
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3333
write!(f, "{}", self.triple)?;
3434
if let Some(beta) = self.beta {
35-
write!(f, "-beta{}", beta)?;
35+
write!(f, "-beta{beta}")?;
3636
}
3737
Ok(())
3838
}

src/apple/cli.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ impl Reportable for Error {
188188
Self::Unsupported => Report::error("iOS is marked as unsupported in your Cargo.toml metadata", "If your project should support Android, modify your Cargo.toml, then run `cargo mobile init` and try again."),
189189
Self::ProjectDirAbsent { project_dir } => Report::action_request(
190190
"Please run `cargo mobile init` and try again!",
191-
format!("Xcode project directory {:?} doesn't exist.", project_dir),
191+
format!("Xcode project directory {project_dir:?} doesn't exist."),
192192
),
193193
Self::OpenFailed(err) => Report::error("Failed to open project in Xcode", err),
194194
Self::CheckFailed(err) => err.report(),
@@ -201,19 +201,19 @@ impl Reportable for Error {
201201
Self::CargoEnvFailed(err) => Report::error("Failed to load cargo env profile", err),
202202
Self::SdkRootInvalid { sdk_root } => Report::error(
203203
"SDK root provided by Xcode was invalid",
204-
format!("{:?} doesn't exist or isn't a directory", sdk_root),
204+
format!("{sdk_root:?} doesn't exist or isn't a directory"),
205205
),
206206
Self::IncludeDirInvalid { include_dir } => Report::error(
207207
"Include dir was invalid",
208-
format!("{:?} doesn't exist or isn't a directory", include_dir),
208+
format!("{include_dir:?} doesn't exist or isn't a directory"),
209209
),
210210
Self::MacosSdkRootInvalid { macos_sdk_root } => Report::error(
211211
"macOS SDK root was invalid",
212-
format!("{:?} doesn't exist or isn't a directory", macos_sdk_root),
212+
format!("{macos_sdk_root:?} doesn't exist or isn't a directory"),
213213
),
214214
Self::ArchInvalid { arch } => Report::error(
215215
"Arch specified by Xcode was invalid",
216-
format!("{:?} isn't a known arch", arch),
216+
format!("{arch:?} isn't a known arch"),
217217
),
218218
Self::CompileLibFailed(err) => err.report(),
219219
Self::PodCommandFailed(err) => Report::error("pod command failed", err),
@@ -484,9 +484,9 @@ impl Exec for Input {
484484
"x86_64" => ("x86_64_apple_ios", "x86_64-apple-ios"),
485485
_ => return Err(Error::ArchInvalid { arch }),
486486
};
487-
let cflags = format!("CFLAGS_{}", triple);
488-
let cxxflags = format!("CFLAGS_{}", triple);
489-
let objc_include_path = format!("OBJC_INCLUDE_PATH_{}", triple);
487+
let cflags = format!("CFLAGS_{triple}");
488+
let cxxflags = format!("CFLAGS_{triple}");
489+
let objc_include_path = format!("OBJC_INCLUDE_PATH_{triple}");
490490
let mut target_env = host_env.clone();
491491
target_env.insert(cflags.as_ref(), isysroot.as_ref());
492492
target_env.insert(cxxflags.as_ref(), isysroot.as_ref());
@@ -532,7 +532,7 @@ impl Exec for Input {
532532
}
533533

534534
// Copy static lib .a to Xcode Project
535-
if rust_triple.starts_with(&"aarch64-apple-ios") {
535+
if rust_triple.starts_with("aarch64-apple-ios") {
536536
std::fs::create_dir_all(format!(
537537
"Sources/{rust_triple}/{}",
538538
profile.as_str()

src/apple/config/mod.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,16 +194,14 @@ impl Display for ProjectDirInvalid {
194194
match self {
195195
Self::NormalizationFailed { project_dir, cause } => write!(
196196
f,
197-
"Xcode project dir {:?} couldn't be normalized: {}",
198-
project_dir, cause
197+
"Xcode project dir {project_dir:?} couldn't be normalized: {cause}"
199198
),
200199
Self::OutsideOfAppRoot {
201200
project_dir,
202201
root_dir,
203202
} => write!(
204203
f,
205-
"Xcode project dir {:?} is outside of the app root dir {:?}",
206-
project_dir, root_dir,
204+
"Xcode project dir {project_dir:?} is outside of the app root dir {root_dir:?}",
207205
),
208206
}
209207
}
@@ -388,7 +386,7 @@ impl Config {
388386
}
389387

390388
pub fn ipa_path(&self) -> Result<PathBuf, (PathBuf, PathBuf)> {
391-
let path = |tail: &str| self.export_dir().join(format!("{}.ipa", tail));
389+
let path = |tail: &str| self.export_dir().join(format!("{tail}.ipa"));
392390
let old = path(&self.scheme());
393391
// It seems like the format changed recently?
394392
let new = path(self.app.stylized_name());

src/apple/config/raw.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ impl Display for DetectError {
1515
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1616
match self {
1717
Self::DeveloperTeamLookupFailed(err) => {
18-
write!(f, "Failed to find Apple developer teams: {}", err)
18+
write!(f, "Failed to find Apple developer teams: {err}")
1919
}
2020
}
2121
}
@@ -31,10 +31,10 @@ impl Display for PromptError {
3131
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3232
match self {
3333
Self::DeveloperTeamLookupFailed(err) => {
34-
write!(f, "Failed to find Apple developer teams: {}", err)
34+
write!(f, "Failed to find Apple developer teams: {err}")
3535
}
3636
Self::DeveloperTeamPromptFailed(err) => {
37-
write!(f, "Failed to prompt for Apple developer team: {}", err)
37+
write!(f, "Failed to prompt for Apple developer team: {err}")
3838
}
3939
}
4040
}
@@ -50,7 +50,7 @@ fn value_to_string(value: &PlistValue) -> String {
5050
.map(value_to_string)
5151
.collect::<Vec<_>>()
5252
.join(",");
53-
format!("[{}]", string)
53+
format!("[{string}]")
5454
}
5555
PlistValue::Dictionary(dict) => dictionary_to_string(dict),
5656
}
@@ -67,7 +67,7 @@ fn dictionary_to_string(dict: &PlistDictionary) -> String {
6767
.map(|pair| pair_to_string(&pair.0.key, &pair.0.value))
6868
.collect::<Vec<_>>()
6969
.join(",");
70-
format!("{{{}}}", joint)
70+
format!("{{{joint}}}")
7171
}
7272

7373
#[derive(Clone, Debug, Deserialize)]

0 commit comments

Comments
 (0)