Skip to content

Commit

Permalink
Fix rust 1.80 clippy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshilliard committed Jul 26, 2024
1 parent d4dc455 commit 9f8f8aa
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 32 deletions.
14 changes: 7 additions & 7 deletions src/build_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1363,7 +1363,7 @@ mod test {
#[test]
fn test_find_bridge_pyo3() {
let pyo3_mixed = MetadataCommand::new()
.manifest_path(&Path::new("test-crates/pyo3-mixed").join("Cargo.toml"))
.manifest_path(Path::new("test-crates/pyo3-mixed").join("Cargo.toml"))
.exec()
.unwrap();

Expand All @@ -1380,7 +1380,7 @@ mod test {
#[test]
fn test_find_bridge_pyo3_abi3() {
let pyo3_pure = MetadataCommand::new()
.manifest_path(&Path::new("test-crates/pyo3-pure").join("Cargo.toml"))
.manifest_path(Path::new("test-crates/pyo3-pure").join("Cargo.toml"))
.exec()
.unwrap();

Expand All @@ -1397,14 +1397,14 @@ mod test {
#[test]
fn test_find_bridge_pyo3_feature() {
let pyo3_pure = MetadataCommand::new()
.manifest_path(&Path::new("test-crates/pyo3-feature").join("Cargo.toml"))
.manifest_path(Path::new("test-crates/pyo3-feature").join("Cargo.toml"))
.exec()
.unwrap();

assert!(find_bridge(&pyo3_pure, None).is_err());

let pyo3_pure = MetadataCommand::new()
.manifest_path(&Path::new("test-crates/pyo3-feature").join("Cargo.toml"))
.manifest_path(Path::new("test-crates/pyo3-feature").join("Cargo.toml"))
.other_options(vec!["--features=pyo3".to_string()])
.exec()
.unwrap();
Expand All @@ -1418,7 +1418,7 @@ mod test {
#[test]
fn test_find_bridge_cffi() {
let cffi_pure = MetadataCommand::new()
.manifest_path(&Path::new("test-crates/cffi-pure").join("Cargo.toml"))
.manifest_path(Path::new("test-crates/cffi-pure").join("Cargo.toml"))
.exec()
.unwrap();

Expand All @@ -1434,7 +1434,7 @@ mod test {
#[test]
fn test_find_bridge_bin() {
let hello_world = MetadataCommand::new()
.manifest_path(&Path::new("test-crates/hello-world").join("Cargo.toml"))
.manifest_path(Path::new("test-crates/hello-world").join("Cargo.toml"))
.exec()
.unwrap();

Expand All @@ -1450,7 +1450,7 @@ mod test {
assert!(find_bridge(&hello_world, Some("pyo3")).is_err());

let pyo3_bin = MetadataCommand::new()
.manifest_path(&Path::new("test-crates/pyo3-bin").join("Cargo.toml"))
.manifest_path(Path::new("test-crates/pyo3-bin").join("Cargo.toml"))
.exec()
.unwrap();
assert!(matches!(
Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
//! - upload: Uses ureq to add the upload command.
//!
//! - rustls: Makes ureq use the rustls stack so that we can build maturin in a CentOS 6
//! docker container and which maturin itself manylinux compliant.
//! docker container and which maturin itself manylinux compliant.
//!
//! - native-tls: Makes ureq use the platform native tls stack
//!
//! - password-storage (off by default): Uses the keyring package to store the password. keyring
//! pulls in a lot of shared libraries and outdated dependencies, so this is off by default, except
//! for the build on the github releases page.
//! (https://github.com/hwchen/secret-service-rs/issues/9)
//! pulls in a lot of shared libraries and outdated dependencies, so this is off by default, except
//! for the build on the github releases page.
//! (https://github.com/hwchen/secret-service-rs/issues/9)

#![deny(missing_docs)]

Expand Down
34 changes: 17 additions & 17 deletions src/module_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ pub fn write_bindings_module(
writer.add_directory(&module)?;
// Reexport the shared library as if it were the top level module
writer.add_bytes(
&module.join("__init__.py"),
module.join("__init__.py"),
None,
format!(
r#"from .{ext_name} import *
Expand All @@ -867,10 +867,10 @@ if hasattr({ext_name}, "__all__"):
let type_stub = project_layout.rust_module.join(format!("{ext_name}.pyi"));
if type_stub.exists() {
eprintln!("📖 Found type stub file at {ext_name}.pyi");
writer.add_file(&module.join("__init__.pyi"), type_stub)?;
writer.add_bytes(&module.join("py.typed"), None, b"")?;
writer.add_file(module.join("__init__.pyi"), type_stub)?;
writer.add_bytes(module.join("py.typed"), None, b"")?;
}
writer.add_file_with_permissions(&module.join(so_filename), artifact, 0o755)?;
writer.add_file_with_permissions(module.join(so_filename), artifact, 0o755)?;
}

Ok(())
Expand Down Expand Up @@ -931,20 +931,20 @@ pub fn write_cffi_module(
.join(format!("{module_name}.pyi"));
if type_stub.exists() {
eprintln!("📖 Found type stub file at {module_name}.pyi");
writer.add_file(&module.join("__init__.pyi"), type_stub)?;
writer.add_bytes(&module.join("py.typed"), None, b"")?;
writer.add_file(module.join("__init__.pyi"), type_stub)?;
writer.add_bytes(module.join("py.typed"), None, b"")?;
}
};

if !editable || project_layout.python_module.is_none() {
writer.add_bytes(
&module.join("__init__.py"),
module.join("__init__.py"),
None,
cffi_init_file(&project_layout.extension_name).as_bytes(),
)?;
writer.add_bytes(&module.join("ffi.py"), None, cffi_declarations.as_bytes())?;
writer.add_bytes(module.join("ffi.py"), None, cffi_declarations.as_bytes())?;
writer.add_file_with_permissions(
&module.join(format!(
module.join(format!(
"{extension_name}.so",
extension_name = &project_layout.extension_name
)),
Expand Down Expand Up @@ -1174,18 +1174,18 @@ pub fn write_uniffi_module(
.join(format!("{module_name}.pyi"));
if type_stub.exists() {
eprintln!("📖 Found type stub file at {module_name}.pyi");
writer.add_file(&module.join("__init__.pyi"), type_stub)?;
writer.add_bytes(&module.join("py.typed"), None, b"")?;
writer.add_file(module.join("__init__.pyi"), type_stub)?;
writer.add_bytes(module.join("py.typed"), None, b"")?;
}
};

if !editable || project_layout.python_module.is_none() {
writer.add_bytes(&module.join("__init__.py"), None, py_init.as_bytes())?;
writer.add_bytes(module.join("__init__.py"), None, py_init.as_bytes())?;
writer.add_file(
module.join(binding_name).with_extension("py"),
uniffi_binding,
)?;
writer.add_file_with_permissions(&module.join(cdylib), artifact, 0o755)?;
writer.add_file_with_permissions(module.join(cdylib), artifact, 0o755)?;
}

Ok(())
Expand All @@ -1208,7 +1208,7 @@ pub fn write_bin(
writer.add_directory(&data_dir)?;

// We can't use add_file since we need to mark the file as executable
writer.add_file_with_permissions(&data_dir.join(bin_name), artifact, 0o755)?;
writer.add_file_with_permissions(data_dir.join(bin_name), artifact, 0o755)?;
Ok(())
}

Expand Down Expand Up @@ -1353,13 +1353,13 @@ pub fn write_dist_info(
writer.add_directory(&dist_info_dir)?;

writer.add_bytes(
&dist_info_dir.join("METADATA"),
dist_info_dir.join("METADATA"),
None,
metadata23.to_file_contents()?.as_bytes(),
)?;

writer.add_bytes(
&dist_info_dir.join("WHEEL"),
dist_info_dir.join("WHEEL"),
None,
wheel_file(tags)?.as_bytes(),
)?;
Expand All @@ -1376,7 +1376,7 @@ pub fn write_dist_info(
}
if !entry_points.is_empty() {
writer.add_bytes(
&dist_info_dir.join("entry_points.txt"),
dist_info_dir.join("entry_points.txt"),
None,
entry_points.as_bytes(),
)?;
Expand Down
2 changes: 1 addition & 1 deletion src/source_distribution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ fn add_cargo_package_files_to_sdist(
add_crate_to_source_distribution(
writer,
&path_dep.manifest_path,
&root_dir.join(relative_path_dep_manifest_dir),
root_dir.join(relative_path_dep_manifest_dir),
&known_path_deps,
false,
skip_cargo_toml,
Expand Down
5 changes: 2 additions & 3 deletions tests/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,13 +511,12 @@ fn abi3_without_version() {
target_os = "linux",
target_env = "gnu",
any(
target_arch = "i686",
target_arch = "x86",
target_arch = "x86_64",
target_arch = "aarch64",
target_arch = "powerpc64",
target_arch = "powerpc64le",
target_arch = "s390x",
target_arch = "armv7"
target_arch = "arm"
)
)),
ignore
Expand Down

0 comments on commit 9f8f8aa

Please sign in to comment.