rust: Update to gio 0.16

This was quite seamless; the only thing I had to tweak was adding
`+ Send` bounds in the `Box<dyn Error>` manual checksum_async API.
This commit is contained in:
Colin Walters committed 2022-11-21 13:18:51 -05:00
1 parent 9d652be3b1
commit 1a76f45fd7
38 files changed
+1145 -4020

No files matched your search

+4 -4
View File
@@ -6,15 +6,15 @@ libc = "0.2"
[dependencies.gio]
package = "gio-sys"
version = "0.15"
version = "0.16"
[dependencies.glib]
package = "glib-sys"
version = "0.15"
version = "0.16"
[dependencies.gobject]
package = "gobject-sys"
version = "0.15"
version = "0.16"
[dev-dependencies]
shell-words = "1.0.0"
@@ -56,7 +56,7 @@ v2019_6 = ["v2019_4"]
v2020_1 = ["v2019_6"]
v2020_2 = ["v2020_1"]
v2020_4 = ["v2020_2"]
dox = []
dox = ["glib/dox", "gobject/dox", "gio/dox"]
v2020_7 = ["v2020_4"]
v2020_8 = ["v2020_7"]
v2021_1 = ["v2020_8"]
+1 -1
View File
@@ -11,7 +11,7 @@ fn main() {} // prevent linking libraries to avoid documentation failure
#[cfg(not(feature = "dox"))]
fn main() {
if let Err(s) = system_deps::Config::new().probe() {
println!("cargo:warning={}", s);
println!("cargo:warning={s}");
process::exit(1);
}
}
+2 -2
View File
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ c8a7a13d2c4d)
from gir-files (@ 94f67628d6ed)
Generated by gir (https://github.com/gtk-rs/gir @ e94fdc6499e4)
from gir-files (@ 0dbd87c01724)
+45 -46
View File
@@ -302,7 +302,7 @@ pub struct OstreeAsyncProgressClass {
impl ::std::fmt::Debug for OstreeAsyncProgressClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeAsyncProgressClass @ {:p}", self))
f.debug_struct(&format!("OstreeAsyncProgressClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.field("changed", &self.changed)
.finish()
@@ -366,7 +366,7 @@ pub struct OstreeCollectionRef {
impl ::std::fmt::Debug for OstreeCollectionRef {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeCollectionRef @ {:p}", self))
f.debug_struct(&format!("OstreeCollectionRef @ {self:p}"))
.field("collection_id", &self.collection_id)
.field("ref_name", &self.ref_name)
.finish()
@@ -384,7 +384,7 @@ pub struct OstreeCommitSizesEntry {
impl ::std::fmt::Debug for OstreeCommitSizesEntry {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeCommitSizesEntry @ {:p}", self))
f.debug_struct(&format!("OstreeCommitSizesEntry @ {self:p}"))
.field("checksum", &self.checksum)
.field("objtype", &self.objtype)
.field("unpacked", &self.unpacked)
@@ -401,7 +401,7 @@ pub struct OstreeContentWriterClass {
impl ::std::fmt::Debug for OstreeContentWriterClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeContentWriterClass @ {:p}", self))
f.debug_struct(&format!("OstreeContentWriterClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.finish()
}
@@ -420,7 +420,7 @@ pub struct OstreeDiffDirsOptions {
impl ::std::fmt::Debug for OstreeDiffDirsOptions {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeDiffDirsOptions @ {:p}", self))
f.debug_struct(&format!("OstreeDiffDirsOptions @ {self:p}"))
.field("owner_uid", &self.owner_uid)
.field("owner_gid", &self.owner_gid)
.field("devino_to_csum_cache", &self.devino_to_csum_cache)
@@ -445,7 +445,7 @@ pub struct OstreeDiffItem {
impl ::std::fmt::Debug for OstreeDiffItem {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeDiffItem @ {:p}", self))
f.debug_struct(&format!("OstreeDiffItem @ {self:p}"))
.field("refcount", &self.refcount)
.field("src", &self.src)
.field("target", &self.target)
@@ -513,7 +513,7 @@ pub struct OstreeMutableTreeClass {
impl ::std::fmt::Debug for OstreeMutableTreeClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeMutableTreeClass @ {:p}", self))
f.debug_struct(&format!("OstreeMutableTreeClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.finish()
}
@@ -528,7 +528,7 @@ pub struct OstreeMutableTreeIter {
impl ::std::fmt::Debug for OstreeMutableTreeIter {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeMutableTreeIter @ {:p}", self))
f.debug_struct(&format!("OstreeMutableTreeIter @ {self:p}"))
.field("in_files", &self.in_files)
.field("iter", &self.iter)
.finish()
@@ -543,8 +543,7 @@ pub struct OstreeRemote {
impl ::std::fmt::Debug for OstreeRemote {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRemote @ {:p}", self))
.finish()
f.debug_struct(&format!("OstreeRemote @ {self:p}")).finish()
}
}
@@ -574,7 +573,7 @@ pub struct OstreeRepoCheckoutAtOptions {
impl ::std::fmt::Debug for OstreeRepoCheckoutAtOptions {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoCheckoutAtOptions @ {:p}", self))
f.debug_struct(&format!("OstreeRepoCheckoutAtOptions @ {self:p}"))
.field("mode", &self.mode)
.field("overwrite_mode", &self.overwrite_mode)
.field("enable_uncompressed_cache", &self.enable_uncompressed_cache)
@@ -612,7 +611,7 @@ pub struct OstreeRepoCheckoutOptions {
impl ::std::fmt::Debug for OstreeRepoCheckoutOptions {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoCheckoutOptions @ {:p}", self))
f.debug_struct(&format!("OstreeRepoCheckoutOptions @ {self:p}"))
.field("mode", &self.mode)
.field("overwrite_mode", &self.overwrite_mode)
.field("enable_uncompressed_cache", &self.enable_uncompressed_cache)
@@ -628,7 +627,7 @@ pub struct OstreeRepoCommitModifier {
impl ::std::fmt::Debug for OstreeRepoCommitModifier {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoCommitModifier @ {:p}", self))
f.debug_struct(&format!("OstreeRepoCommitModifier @ {self:p}"))
.finish()
}
}
@@ -643,7 +642,7 @@ pub struct OstreeRepoCommitTraverseIter {
impl ::std::fmt::Debug for OstreeRepoCommitTraverseIter {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoCommitTraverseIter @ {:p}", self))
f.debug_struct(&format!("OstreeRepoCommitTraverseIter @ {self:p}"))
.field("initialized", &self.initialized)
.field("dummy", &self.dummy)
.finish()
@@ -658,7 +657,7 @@ pub struct OstreeRepoDevInoCache {
impl ::std::fmt::Debug for OstreeRepoDevInoCache {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoDevInoCache @ {:p}", self))
f.debug_struct(&format!("OstreeRepoDevInoCache @ {self:p}"))
.finish()
}
}
@@ -672,7 +671,7 @@ pub struct OstreeRepoExportArchiveOptions {
impl ::std::fmt::Debug for OstreeRepoExportArchiveOptions {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoExportArchiveOptions @ {:p}", self))
f.debug_struct(&format!("OstreeRepoExportArchiveOptions @ {self:p}"))
.field("disable_xattrs", &self.disable_xattrs)
.finish()
}
@@ -686,7 +685,7 @@ pub struct OstreeRepoFileClass {
impl ::std::fmt::Debug for OstreeRepoFileClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoFileClass @ {:p}", self))
f.debug_struct(&format!("OstreeRepoFileClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.finish()
}
@@ -708,7 +707,7 @@ pub struct OstreeRepoFinderAvahiClass {
impl ::std::fmt::Debug for OstreeRepoFinderAvahiClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoFinderAvahiClass @ {:p}", self))
f.debug_struct(&format!("OstreeRepoFinderAvahiClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.finish()
}
@@ -722,7 +721,7 @@ pub struct OstreeRepoFinderConfigClass {
impl ::std::fmt::Debug for OstreeRepoFinderConfigClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoFinderConfigClass @ {:p}", self))
f.debug_struct(&format!("OstreeRepoFinderConfigClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.finish()
}
@@ -753,7 +752,7 @@ pub struct OstreeRepoFinderInterface {
impl ::std::fmt::Debug for OstreeRepoFinderInterface {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoFinderInterface @ {:p}", self))
f.debug_struct(&format!("OstreeRepoFinderInterface @ {self:p}"))
.field("g_iface", &self.g_iface)
.field("resolve_async", &self.resolve_async)
.field("resolve_finish", &self.resolve_finish)
@@ -769,7 +768,7 @@ pub struct OstreeRepoFinderMountClass {
impl ::std::fmt::Debug for OstreeRepoFinderMountClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoFinderMountClass @ {:p}", self))
f.debug_struct(&format!("OstreeRepoFinderMountClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.finish()
}
@@ -783,7 +782,7 @@ pub struct OstreeRepoFinderOverrideClass {
impl ::std::fmt::Debug for OstreeRepoFinderOverrideClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoFinderOverrideClass @ {:p}", self))
f.debug_struct(&format!("OstreeRepoFinderOverrideClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.finish()
}
@@ -803,7 +802,7 @@ pub struct OstreeRepoFinderResult {
impl ::std::fmt::Debug for OstreeRepoFinderResult {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoFinderResult @ {:p}", self))
f.debug_struct(&format!("OstreeRepoFinderResult @ {self:p}"))
.field("remote", &self.remote)
.field("finder", &self.finder)
.field("priority", &self.priority)
@@ -823,7 +822,7 @@ pub struct OstreeRepoImportArchiveOptions {
impl ::std::fmt::Debug for OstreeRepoImportArchiveOptions {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoImportArchiveOptions @ {:p}", self))
f.debug_struct(&format!("OstreeRepoImportArchiveOptions @ {self:p}"))
.field(
"ignore_unsupported_content",
&self.ignore_unsupported_content,
@@ -844,7 +843,7 @@ pub struct OstreeRepoPruneOptions {
impl ::std::fmt::Debug for OstreeRepoPruneOptions {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoPruneOptions @ {:p}", self))
f.debug_struct(&format!("OstreeRepoPruneOptions @ {self:p}"))
.field("flags", &self.flags)
.field("reachable", &self.reachable)
.field("unused_bools", &self.unused_bools)
@@ -871,7 +870,7 @@ pub struct OstreeRepoTransactionStats {
impl ::std::fmt::Debug for OstreeRepoTransactionStats {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoTransactionStats @ {:p}", self))
f.debug_struct(&format!("OstreeRepoTransactionStats @ {self:p}"))
.field("metadata_objects_total", &self.metadata_objects_total)
.field("metadata_objects_written", &self.metadata_objects_written)
.field("content_objects_total", &self.content_objects_total)
@@ -945,7 +944,7 @@ pub struct OstreeSignInterface {
impl ::std::fmt::Debug for OstreeSignInterface {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeSignInterface @ {:p}", self))
f.debug_struct(&format!("OstreeSignInterface @ {self:p}"))
.field("g_iface", &self.g_iface)
.field("get_name", &self.get_name)
.field("data", &self.data)
@@ -973,7 +972,7 @@ pub struct OstreeSysrootDeployTreeOpts {
impl ::std::fmt::Debug for OstreeSysrootDeployTreeOpts {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeSysrootDeployTreeOpts @ {:p}", self))
f.debug_struct(&format!("OstreeSysrootDeployTreeOpts @ {self:p}"))
.field("unused_bools", &self.unused_bools)
.field("unused_ints", &self.unused_ints)
.field("override_kernel_argv", &self.override_kernel_argv)
@@ -994,7 +993,7 @@ pub struct OstreeSysrootWriteDeploymentsOpts {
impl ::std::fmt::Debug for OstreeSysrootWriteDeploymentsOpts {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeSysrootWriteDeploymentsOpts @ {:p}", self))
f.debug_struct(&format!("OstreeSysrootWriteDeploymentsOpts @ {self:p}"))
.field("do_postclean", &self.do_postclean)
.field("unused_bools", &self.unused_bools)
.field("unused_ints", &self.unused_ints)
@@ -1012,7 +1011,7 @@ pub struct OstreeAsyncProgress {
impl ::std::fmt::Debug for OstreeAsyncProgress {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeAsyncProgress @ {:p}", self))
f.debug_struct(&format!("OstreeAsyncProgress @ {self:p}"))
.finish()
}
}
@@ -1025,7 +1024,7 @@ pub struct OstreeBootconfigParser {
impl ::std::fmt::Debug for OstreeBootconfigParser {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeBootconfigParser @ {:p}", self))
f.debug_struct(&format!("OstreeBootconfigParser @ {self:p}"))
.finish()
}
}
@@ -1038,7 +1037,7 @@ pub struct OstreeContentWriter {
impl ::std::fmt::Debug for OstreeContentWriter {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeContentWriter @ {:p}", self))
f.debug_struct(&format!("OstreeContentWriter @ {self:p}"))
.finish()
}
}
@@ -1051,7 +1050,7 @@ pub struct OstreeDeployment {
impl ::std::fmt::Debug for OstreeDeployment {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeDeployment @ {:p}", self))
f.debug_struct(&format!("OstreeDeployment @ {self:p}"))
.finish()
}
}
@@ -1064,7 +1063,7 @@ pub struct OstreeGpgVerifyResult {
impl ::std::fmt::Debug for OstreeGpgVerifyResult {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeGpgVerifyResult @ {:p}", self))
f.debug_struct(&format!("OstreeGpgVerifyResult @ {self:p}"))
.finish()
}
}
@@ -1077,7 +1076,7 @@ pub struct OstreeMutableTree {
impl ::std::fmt::Debug for OstreeMutableTree {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeMutableTree @ {:p}", self))
f.debug_struct(&format!("OstreeMutableTree @ {self:p}"))
.finish()
}
}
@@ -1090,7 +1089,7 @@ pub struct OstreeRepo {
impl ::std::fmt::Debug for OstreeRepo {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepo @ {:p}", self)).finish()
f.debug_struct(&format!("OstreeRepo @ {self:p}")).finish()
}
}
@@ -1102,7 +1101,7 @@ pub struct OstreeRepoFile {
impl ::std::fmt::Debug for OstreeRepoFile {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoFile @ {:p}", self))
f.debug_struct(&format!("OstreeRepoFile @ {self:p}"))
.finish()
}
}
@@ -1115,7 +1114,7 @@ pub struct OstreeRepoFinderAvahi {
impl ::std::fmt::Debug for OstreeRepoFinderAvahi {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoFinderAvahi @ {:p}", self))
f.debug_struct(&format!("OstreeRepoFinderAvahi @ {self:p}"))
.finish()
}
}
@@ -1128,7 +1127,7 @@ pub struct OstreeRepoFinderConfig {
impl ::std::fmt::Debug for OstreeRepoFinderConfig {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoFinderConfig @ {:p}", self))
f.debug_struct(&format!("OstreeRepoFinderConfig @ {self:p}"))
.finish()
}
}
@@ -1141,7 +1140,7 @@ pub struct OstreeRepoFinderMount {
impl ::std::fmt::Debug for OstreeRepoFinderMount {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoFinderMount @ {:p}", self))
f.debug_struct(&format!("OstreeRepoFinderMount @ {self:p}"))
.finish()
}
}
@@ -1154,7 +1153,7 @@ pub struct OstreeRepoFinderOverride {
impl ::std::fmt::Debug for OstreeRepoFinderOverride {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoFinderOverride @ {:p}", self))
f.debug_struct(&format!("OstreeRepoFinderOverride @ {self:p}"))
.finish()
}
}
@@ -1167,7 +1166,7 @@ pub struct OstreeSePolicy {
impl ::std::fmt::Debug for OstreeSePolicy {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeSePolicy @ {:p}", self))
f.debug_struct(&format!("OstreeSePolicy @ {self:p}"))
.finish()
}
}
@@ -1180,7 +1179,7 @@ pub struct OstreeSysroot {
impl ::std::fmt::Debug for OstreeSysroot {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeSysroot @ {:p}", self))
f.debug_struct(&format!("OstreeSysroot @ {self:p}"))
.finish()
}
}
@@ -1193,7 +1192,7 @@ pub struct OstreeSysrootUpgrader {
impl ::std::fmt::Debug for OstreeSysrootUpgrader {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeSysrootUpgrader @ {:p}", self))
f.debug_struct(&format!("OstreeSysrootUpgrader @ {self:p}"))
.finish()
}
}
@@ -1207,7 +1206,7 @@ pub struct OstreeRepoFinder {
impl ::std::fmt::Debug for OstreeRepoFinder {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
write!(f, "OstreeRepoFinder @ {:p}", self)
write!(f, "OstreeRepoFinder @ {self:p}")
}
}
@@ -1219,7 +1218,7 @@ pub struct OstreeSign {
impl ::std::fmt::Debug for OstreeSign {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
write!(f, "OstreeSign @ {:p}", self)
write!(f, "OstreeSign @ {self:p}")
}
}
+15 -30
View File
@@ -40,7 +40,7 @@ impl Compiler {
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}", &cmd, status).into());
return Err(format!("compilation command {cmd:?} failed, {status}").into());
}
Ok(())
}
@@ -56,7 +56,7 @@ fn get_var(name: &str, default: &str) -> Result<Vec<String>, Box<dyn Error>> {
match env::var(name) {
Ok(value) => Ok(shell_words::split(&value)?),
Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?),
Err(err) => Err(format!("{} {}", name, err).into()),
Err(err) => Err(format!("{name} {err}").into()),
}
}
@@ -70,7 +70,7 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
return Err(format!("command {:?} returned {}", &cmd, out.status).into());
return Err(format!("command {cmd:?} returned {}", out.status).into());
}
let stdout = str::from_utf8(&out.stdout)?;
Ok(shell_words::split(stdout.trim())?)
@@ -115,13 +115,8 @@ fn cross_validate_constants_with_c() {
let mut c_constants: Vec<(String, String)> = Vec::new();
for l in get_c_output("constant").unwrap().lines() {
let mut words = l.trim().split(';');
let name = words.next().expect("Failed to parse name").to_owned();
let value = words
.next()
.and_then(|s| s.parse().ok())
.expect("Failed to parse value");
c_constants.push((name, value));
let (name, value) = l.split_once(';').expect("Missing ';' separator");
c_constants.push((name.to_owned(), value.to_owned()));
}
let mut results = Results::default();
@@ -131,15 +126,14 @@ fn cross_validate_constants_with_c() {
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}");
continue;
}
if rust_value != c_value {
results.record_failed();
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_value, &c_value
"Constant value mismatch for {rust_name}\nRust: {rust_value:?}\nC: {c_value:?}",
);
continue;
}
@@ -156,17 +150,11 @@ fn cross_validate_layout_with_c() {
let mut c_layouts = Vec::new();
for l in get_c_output("layout").unwrap().lines() {
let mut words = l.trim().split(';');
let name = words.next().expect("Failed to parse name").to_owned();
let size = words
.next()
.and_then(|s| s.parse().ok())
.expect("Failed to parse size");
let alignment = words
.next()
.and_then(|s| s.parse().ok())
.expect("Failed to parse alignment");
c_layouts.push((name, Layout { size, alignment }));
let (name, value) = l.split_once(';').expect("Missing first ';' separator");
let (size, alignment) = value.split_once(';').expect("Missing second ';' separator");
let size = size.parse().expect("Failed to parse size");
let alignment = alignment.parse().expect("Failed to parse alignment");
c_layouts.push((name.to_owned(), Layout { size, alignment }));
}
let mut results = Results::default();
@@ -175,16 +163,13 @@ fn cross_validate_layout_with_c() {
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}");
continue;
}
if rust_layout != c_layout {
results.record_failed();
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_layout, &c_layout
);
eprintln!("Layout mismatch for {rust_name}\nRust: {rust_layout:?}\nC: {c_layout:?}",);
continue;
}
@@ -205,7 +190,7 @@ fn get_c_output(name: &str) -> Result<String, Box<dyn Error>> {
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
return Err(format!("command {abi_cmd:?} failed, {output:?}").into());
}
Ok(String::from_utf8(output.stdout)?)