Skip to content

Commit ef23551

Browse files
committed
Fix all new clippy lints since Rust 1.88
1 parent 5662af2 commit ef23551

File tree

23 files changed

+72
-91
lines changed

23 files changed

+72
-91
lines changed

apk/src/compiler/attributes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ impl Strings {
108108
self.strings
109109
.iter()
110110
.position(|s| s == s2)
111-
.with_context(|| format!("all strings added to the string pool: {}", s2))
111+
.with_context(|| format!("all strings added to the string pool: {s2}"))
112112
.unwrap() as i32
113113
}
114114
}

apk/src/compiler/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const DPI_SIZE: [u32; 5] = [48, 72, 96, 144, 192];
2121
fn variants(name: &str) -> impl Iterator<Item = (String, u32)> + '_ {
2222
DPI_SIZE
2323
.into_iter()
24-
.map(move |size| (format!("res/{0}/{0}{1}.png", name, size), size))
24+
.map(move |size| (format!("res/{name}/{name}{size}.png"), size))
2525
}
2626

2727
pub fn compile_mipmap<'a>(package_name: &str, name: &'a str) -> Result<Mipmap<'a>> {
@@ -133,7 +133,7 @@ mod tests {
133133
let mut cursor = Cursor::new(&buf);
134134
let chunk = Chunk::parse(&mut cursor)?;
135135
println!("{:#?}", mipmap.chunk());
136-
println!("{:#?}", chunk);
136+
println!("{chunk:#?}");
137137
assert_eq!(*mipmap.chunk(), chunk);
138138
Ok(())
139139
}

apk/src/compiler/table.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ impl<'a> Ref<'a> {
2929
pub fn parse(s: &'a str) -> Result<Self> {
3030
let s = s
3131
.strip_prefix('@')
32-
.with_context(|| format!("invalid reference {}: expected `@`", s))?;
32+
.with_context(|| format!("invalid reference {s}: expected `@`"))?;
3333
let (descr, name) = s
3434
.split_once('/')
35-
.with_context(|| format!("invalid reference {}: expected `/`", s))?;
35+
.with_context(|| format!("invalid reference {s}: expected `/`"))?;
3636
let (package, ty) = if let Some((package, ty)) = descr.split_once(':') {
3737
(Some(package), ty)
3838
} else {
@@ -75,7 +75,7 @@ impl<'a> Package<'a> {
7575
.types
7676
.iter()
7777
.position(|s| s.as_str() == name)
78-
.with_context(|| format!("failed to locate type id {}", name))?;
78+
.with_context(|| format!("failed to locate type id {name}"))?;
7979
Ok(id as u8 + 1)
8080
}
8181

@@ -84,7 +84,7 @@ impl<'a> Package<'a> {
8484
.keys
8585
.iter()
8686
.position(|s| s.as_str() == name)
87-
.with_context(|| format!("failed to locate key id {}", name))?;
87+
.with_context(|| format!("failed to locate key id {name}"))?;
8888
Ok(id as u32)
8989
}
9090

@@ -122,17 +122,17 @@ impl<'a> Type<'a> {
122122
false
123123
}
124124
})
125-
.with_context(|| format!("failed to lookup entry id {}", key))?;
125+
.with_context(|| format!("failed to lookup entry id {key}"))?;
126126
Ok(id as u16)
127127
}
128128

129129
pub fn lookup_entry(&self, id: u16) -> Result<Entry<'a>> {
130130
let entry = self
131131
.entries
132132
.get(id as usize)
133-
.with_context(|| format!("failed to lookup entry {}", id))?
133+
.with_context(|| format!("failed to lookup entry {id}"))?
134134
.as_ref()
135-
.with_context(|| format!("failed to lookup entry {}", id))?;
135+
.with_context(|| format!("failed to lookup entry {id}"))?;
136136
let id = ResTableRef::new(self.package, self.id, id);
137137
Ok(Entry { id, entry })
138138
}
@@ -165,7 +165,7 @@ impl Entry<'_> {
165165
if let Some(value) = ResAttributeType::from_u32(entries[0].value.data) {
166166
Some(value)
167167
} else {
168-
panic!("attribute_type: 0x{:x}", data);
168+
panic!("attribute_type: 0x{data:x}");
169169
}
170170
} else {
171171
None

apk/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ pub(crate) mod tests {
241241
let home = std::env::var("ANDROID_HOME")?;
242242
let android = Path::new(&home)
243243
.join("platforms")
244-
.join(format!("android-{}", platform))
244+
.join(format!("android-{platform}"))
245245
.join("android.jar");
246246
Ok(android)
247247
}

apk/src/manifest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ pub struct Feature {
221221
/// for available levels and the respective Vulkan features required/provided.
222222
///
223223
/// - `name="android.hardware.vulkan.version"`: Represents the value of Vulkan's `VkPhysicalDeviceProperties::apiVersion`. See the [Android documentation](https://developer.android.com/reference/android/content/pm/PackageManager#FEATURE_VULKAN_HARDWARE_VERSION)
224-
/// for available levels and the respective Vulkan features required/provided.
224+
/// for available levels and the respective Vulkan features required/provided.
225225
#[serde(rename(serialize = "android:version"))]
226226
pub version: Option<u32>,
227227
#[serde(rename(serialize = "android:glEsVersion"))]

apk/src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ impl VersionCode {
3838
}
3939

4040
pub fn from_semver(version: &str) -> Result<Self> {
41-
let mut iter = version.split(|c1| ['.', '-', '+'].iter().any(|c2| c1 == *c2));
41+
let mut iter = version.split(|c1| ['.', '-', '+'].contains(&c1));
4242
let mut p = || {
4343
iter.next()
4444
.context("invalid semver")?

appbundle/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ impl AppBundle {
9191

9292
if self.ios() {
9393
for size in sizes {
94-
let filename = format!("icon_{}x{}.png", size, size);
94+
let filename = format!("icon_{size}x{size}.png");
9595
let icon = self.appdir.join(&filename);
9696
let mut icon = BufWriter::new(File::create(icon)?);
9797
scaler.write(&mut icon, ScalerOpts::new(*size))?;
@@ -167,7 +167,7 @@ impl AppBundle {
167167
.map_err(|err| anyhow::anyhow!("{}", err))?;
168168
let xml = data.encap_content_info.content.as_ref().unwrap().as_ref();
169169
let profile: plist::Value = plist::from_reader_xml(xml)?;
170-
log::debug!("provisioning profile: {:?}", profile);
170+
log::debug!("provisioning profile: {profile:?}");
171171
let dict = profile
172172
.as_dictionary()
173173
.context("invalid provisioning profile")?;
@@ -184,7 +184,7 @@ impl AppBundle {
184184
.context("missing application identifier")?;
185185
let bundle_prefix = app_id
186186
.split_once('.')
187-
.with_context(|| format!("invalid app id {}", app_id))?
187+
.with_context(|| format!("invalid app id {app_id}"))?
188188
.1;
189189
self.development = dict.get("ProvisionedDevices").is_some();
190190

@@ -292,7 +292,7 @@ pub fn notarize(path: &Path, api_key: &Path) -> Result<()> {
292292
} else {
293293
anyhow::bail!("impossible");
294294
};
295-
println!("submission id: {}", submission_id);
295+
println!("submission id: {submission_id}");
296296
let start_time = Instant::now();
297297
loop {
298298
let resp = notarizer.get_submission(&submission_id)?;
@@ -301,7 +301,7 @@ pub fn notarize(path: &Path, api_key: &Path) -> Result<()> {
301301
println!("poll state after {}s: {:?}", elapsed.as_secs(), status,);
302302
if status != SubmissionResponseStatus::InProgress {
303303
let log = notarizer.fetch_notarization_log(&submission_id)?;
304-
println!("{}", log);
304+
println!("{log}");
305305
resp.into_result()?;
306306
break;
307307
}

appimage/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub struct AppImage {
1616

1717
impl AppImage {
1818
pub fn new(build_dir: &Path, name: String) -> Result<Self> {
19-
let appdir = build_dir.join(format!("{}.AppDir", name));
19+
let appdir = build_dir.join(format!("{name}.AppDir"));
2020
std::fs::remove_dir_all(&appdir).ok();
2121
std::fs::create_dir_all(&appdir)?;
2222
Ok(Self { appdir, name })

msix/src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,7 @@ fn to_xml<T: Serialize>(xml: &T, standalone: bool) -> Vec<u8> {
160160
let mut buf = vec![];
161161
let standalone = if standalone { "yes" } else { "no" };
162162
buf.extend_from_slice(
163-
format!(
164-
r#"<?xml version="1.0" encoding="UTF-8" standalone="{}"?>"#,
165-
standalone
166-
)
167-
.as_bytes(),
163+
format!(r#"<?xml version="1.0" encoding="UTF-8" standalone="{standalone}"?>"#).as_bytes(),
168164
);
169165
quick_xml::se::to_writer(&mut buf, xml).unwrap();
170166
buf

msix/src/manifest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,6 @@ mod tests {
328328
..Default::default()
329329
};
330330
let xml = quick_xml::se::to_string(&manifest).unwrap();
331-
println!("{}", xml);
331+
println!("{xml}");
332332
}
333333
}

0 commit comments

Comments
 (0)