Skip to content

Commit b918f55

Browse files
committed
chore: move to edition 2024
This will enable us to use let chains in the future among other things: rust-lang/rust#132833
1 parent 8907742 commit b918f55

File tree

175 files changed

+1088
-867
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+1088
-867
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ members = ["crates/*"]
88

99
[workspace.package]
1010
authors = ["pixi contributors <[email protected]>"]
11-
edition = "2021"
11+
edition = "2024"
1212
homepage = "https://github.com/prefix-dev/pixi"
1313
license = "BSD-3-Clause"
1414
readme = "README.md"

crates/pixi_allocator/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[package]
22
description = "A crate that provides the best memory allocator for different platforms"
3-
edition = "2021"
43
name = "pixi_allocator"
54
version = "0.1.0"
65

crates/pixi_build_frontend/src/backend_override.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,9 @@ mod tests {
202202

203203
#[test]
204204
fn test_invalid_format() {
205-
let input = format!("pixi-build-python{EQUALS}/some/path/to/custom-build{SEPARATOR}invalid{EQUALS}tool{EQUALS}extra");
205+
let input = format!(
206+
"pixi-build-python{EQUALS}/some/path/to/custom-build{SEPARATOR}invalid{EQUALS}tool{EQUALS}extra"
207+
);
206208
let parsed = OverriddenBackends::from_str(input.as_str());
207209
assert!(parsed.is_err());
208210
}

crates/pixi_build_frontend/src/build_frontend.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ use miette::Diagnostic;
55
use rattler_conda_types::ChannelConfig;
66

77
use crate::{
8-
protocol,
8+
SetupRequest, ToolContext, protocol,
99
protocol_builder::{EnabledProtocols, ProtocolBuilder},
1010
protocols::JsonRPCBuildProtocol,
11-
SetupRequest, ToolContext,
1211
};
1312

1413
/// The frontend for building packages.

crates/pixi_build_frontend/src/jsonrpc/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use serde::Serialize;
33
use serde_json::value::RawValue;
44

55
mod stdio;
6-
pub(crate) use stdio::{stdio_transport, Receiver, Sender};
6+
pub(crate) use stdio::{Receiver, Sender, stdio_transport};
77

88
/// A helper struct to convert a serializable type into a JSON-RPC parameter.
99
pub struct RpcParams<T>(pub T);

crates/pixi_build_frontend/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ mod protocols;
66

77
use std::fmt::{Debug, Formatter};
88

9-
pub use protocols::builders::{pixi_protocol, rattler_build_protocol};
109
pub use protocols::JsonRPCBuildProtocol;
10+
pub use protocols::builders::{pixi_protocol, rattler_build_protocol};
1111

1212
mod protocol_builder;
1313
mod reporters;

crates/pixi_build_frontend/src/protocol_builder.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ use std::{
77
use rattler_conda_types::ChannelConfig;
88

99
use crate::{
10+
BuildFrontendError, ToolContext,
1011
backend_override::BackendOverride,
1112
pixi_protocol,
1213
protocol::{DiscoveryError, FinishError},
1314
protocols::JsonRPCBuildProtocol,
14-
rattler_build_protocol, BuildFrontendError, ToolContext,
15+
rattler_build_protocol,
1516
};
1617

1718
/// Configuration to enable or disable certain protocols discovery.

crates/pixi_build_frontend/src/protocols/builders/pixi.rs

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ use thiserror::Error;
1414
use which::Error;
1515

1616
use crate::{
17+
InProcessBackend, ToolContext,
1718
backend_override::BackendOverride,
1819
jsonrpc::{Receiver, Sender},
1920
protocols::{InitializeError, JsonRPCBuildProtocol},
2021
tool::{IsolatedToolSpec, ToolCacheError, ToolSpec},
21-
InProcessBackend, ToolContext,
2222
};
2323

2424
/// A protocol that uses a pixi manifest to invoke a build backend .
@@ -60,14 +60,37 @@ impl Display for FinishError {
6060
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
6161
match self {
6262
FinishError::Init(init) => write!(f, "{init}"),
63-
FinishError::NoBuildSection(_) => write!(f, "failed to setup a build backend, the project manifest does not contain a [build-system] section"),
63+
FinishError::NoBuildSection(_) => write!(
64+
f,
65+
"failed to setup a build backend, the project manifest does not contain a [build-system] section"
66+
),
6467
FinishError::Tool(ToolCacheError::Instantiate(tool, err)) => match err {
65-
Error::CannotGetCurrentDirAndPathListEmpty | Error::CannotFindBinaryPath => write!(f, "failed to setup a build backend, the backend tool '{}' could not be found", tool.display()),
66-
Error::CannotCanonicalize => write!(f, "failed to setup a build backend, although the backend tool '{}' can be resolved it could not be canonicalized", tool.display()),
68+
Error::CannotGetCurrentDirAndPathListEmpty | Error::CannotFindBinaryPath => write!(
69+
f,
70+
"failed to setup a build backend, the backend tool '{}' could not be found",
71+
tool.display()
72+
),
73+
Error::CannotCanonicalize => write!(
74+
f,
75+
"failed to setup a build backend, although the backend tool '{}' can be resolved it could not be canonicalized",
76+
tool.display()
77+
),
6778
},
68-
FinishError::Tool(ToolCacheError::Install(report)) => write!(f, "failed to setup a build backend, the backend tool could not be installed: {}", report),
69-
FinishError::Tool(ToolCacheError::CacheDir(report)) => write!(f, "failed to setup a build backend, the cache dir could not be discovered: {}", report),
70-
FinishError::SpecConversionError(err) => write!(f, "failed to setup a build backend, the backend tool spec could not be converted: {}", err),
79+
FinishError::Tool(ToolCacheError::Install(report)) => write!(
80+
f,
81+
"failed to setup a build backend, the backend tool could not be installed: {}",
82+
report
83+
),
84+
FinishError::Tool(ToolCacheError::CacheDir(report)) => write!(
85+
f,
86+
"failed to setup a build backend, the cache dir could not be discovered: {}",
87+
report
88+
),
89+
FinishError::SpecConversionError(err) => write!(
90+
f,
91+
"failed to setup a build backend, the backend tool spec could not be converted: {}",
92+
err
93+
),
7194
}
7295
}
7396
}

crates/pixi_build_frontend/src/protocols/builders/rattler_build.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ use thiserror::Error;
99

1010
use super::pixi::ProtocolBuildError as PixiProtocolBuildError;
1111
use crate::{
12+
ToolContext,
1213
backend_override::BackendOverride,
1314
protocols::{InitializeError, JsonRPCBuildProtocol},
1415
tool::{IsolatedToolSpec, ToolCacheError, ToolSpec},
15-
ToolContext,
1616
};
1717

1818
const DEFAULT_BUILD_TOOL: &str = "pixi-build-rattler-build";
@@ -26,7 +26,8 @@ pub enum FinishError {
2626
#[diagnostic(transparent)]
2727
Init(#[from] InitializeError),
2828

29-
#[error("failed to setup a build backend, the project manifest at {0} does not contain a [build] section"
29+
#[error(
30+
"failed to setup a build backend, the project manifest at {0} does not contain a [build] section"
3031
)]
3132
NoBuildSection(PathBuf),
3233
}

crates/pixi_build_frontend/src/protocols/mod.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@ use futures::TryFutureExt;
1010
use jsonrpsee::{
1111
async_client::{Client, ClientBuilder},
1212
core::{
13-
client::{ClientT, Error, TransportReceiverT, TransportSenderT},
1413
ClientError,
14+
client::{ClientT, Error, TransportReceiverT, TransportSenderT},
1515
},
1616
types::ErrorCode,
1717
};
1818
use miette::Diagnostic;
1919
use pixi_build_type_conversions::to_project_model_v1;
2020
use pixi_build_types::{
21+
BackendCapabilities, FrontendCapabilities,
2122
procedures::{
2223
self,
2324
conda_build::{CondaBuildParams, CondaBuildResult},
2425
conda_metadata::{CondaMetadataParams, CondaMetadataResult},
2526
initialize::{InitializeParams, InitializeResult},
2627
negotiate_capabilities::{NegotiateCapabilitiesParams, NegotiateCapabilitiesResult},
2728
},
28-
BackendCapabilities, FrontendCapabilities,
2929
};
3030
use pixi_manifest::PackageManifest;
3131
use rattler_conda_types::ChannelConfig;
@@ -34,14 +34,14 @@ use thiserror::Error;
3434
use tokio::{
3535
io::{AsyncBufReadExt, BufReader, Lines},
3636
process::ChildStderr,
37-
sync::{oneshot, Mutex},
37+
sync::{Mutex, oneshot},
3838
};
3939

4040
use crate::{
41-
jsonrpc::{stdio_transport, RpcParams},
41+
CondaBuildReporter, CondaMetadataReporter,
42+
jsonrpc::{RpcParams, stdio_transport},
4243
protocols::stderr::stderr_buffer,
4344
tool::Tool,
44-
CondaBuildReporter, CondaMetadataReporter,
4545
};
4646

4747
pub mod builders;
@@ -60,7 +60,9 @@ pub enum BuildBackendSetupError {
6060
#[derive(Debug, Error, Diagnostic)]
6161
pub enum InitializeError {
6262
#[error("failed to setup communication with the build-backend")]
63-
#[diagnostic(help("This is often caused by a broken build-backend. Try upgrading or downgrading the build backend."))]
63+
#[diagnostic(help(
64+
"This is often caused by a broken build-backend. Try upgrading or downgrading the build backend."
65+
))]
6466
Setup(
6567
#[diagnostic_source]
6668
#[from]

crates/pixi_build_frontend/src/protocols/stderr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::sync::Arc;
33
use tokio::{
44
io::{BufReader, Lines},
55
process::ChildStderr,
6-
sync::{mpsc, oneshot, Mutex},
6+
sync::{Mutex, mpsc, oneshot},
77
};
88

99
/// Stderr stream that captures the stderr output of the backend

crates/pixi_build_frontend/src/tool/cache.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use rattler_shell::{
1616
};
1717
use tokio::sync::broadcast;
1818

19-
use super::{installer::ToolInstaller, IsolatedTool};
19+
use super::{IsolatedTool, installer::ToolInstaller};
2020
use crate::IsolatedToolSpec;
2121

2222
/// A entity that is either pending or has been fetched.
@@ -302,12 +302,12 @@ mod tests {
302302
use tokio::sync::{Barrier, Mutex, Semaphore};
303303

304304
use crate::{
305+
IsolatedToolSpec,
305306
tool::{
306-
cache::{find_spec_records, ToolCache},
307-
installer::{ToolContext, ToolInstaller},
308307
IsolatedTool, ToolSpec,
308+
cache::{ToolCache, find_spec_records},
309+
installer::{ToolContext, ToolInstaller},
309310
},
310-
IsolatedToolSpec,
311311
};
312312

313313
const BAT_META_JSON: &str = "bat-0.24.0-h3bba108_1.json";

crates/pixi_build_frontend/src/tool/installer.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ use rattler_shell::{
88
activation::{ActivationVariables, Activator},
99
shell::ShellEnum,
1010
};
11-
use rattler_solve::{resolvo::Solver, SolverImpl, SolverTask};
11+
use rattler_solve::{SolverImpl, SolverTask, resolvo::Solver};
1212
use rattler_virtual_packages::{VirtualPackage, VirtualPackageOverrides};
1313
use reqwest_middleware::ClientWithMiddleware;
1414
use std::fmt::Debug;
1515
use std::future::Future;
1616
use std::path::PathBuf;
1717

1818
use super::{
19-
cache::ToolCache, IsolatedTool, IsolatedToolSpec, SystemTool, Tool, ToolCacheError, ToolSpec,
19+
IsolatedTool, IsolatedToolSpec, SystemTool, Tool, ToolCacheError, ToolSpec, cache::ToolCache,
2020
};
2121

22-
use miette::{miette, IntoDiagnostic};
22+
use miette::{IntoDiagnostic, miette};
2323

2424
/// A trait that is responsible for installing tools.
2525
pub trait ToolInstaller {

crates/pixi_build_frontend/tests/diagnostics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ use futures::{SinkExt, StreamExt};
55
use miette::{Diagnostic, GraphicalReportHandler, GraphicalTheme};
66
use pixi_build_frontend::{BuildFrontend, InProcessBackend, SetupRequest, ToolContext};
77
use pixi_manifest::{
8-
toml::{ExternalWorkspaceProperties, FromTomlStr, TomlManifest},
98
BuildBackend, KnownPreviewFeature, Package, PackageBuild, PackageManifest, Preview, Workspace,
109
WorkspaceManifest,
10+
toml::{ExternalWorkspaceProperties, FromTomlStr, TomlManifest},
1111
};
1212
use pixi_spec::BinarySpec;
1313
use rattler_conda_types::{NamedChannelOrUrl, PackageName, Platform};

crates/pixi_build_types/src/project_model.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ use std::path::PathBuf;
2020

2121
use indexmap::IndexMap;
2222
use rattler_conda_types::{BuildNumberSpec, StringMatcher, Version, VersionSpec};
23-
use rattler_digest::{serde::SerializableHash, Md5, Md5Hash, Sha256, Sha256Hash};
23+
use rattler_digest::{Md5, Md5Hash, Sha256, Sha256Hash, serde::SerializableHash};
2424
use serde::{Deserialize, Serialize};
25-
use serde_with::serde_as;
2625
use serde_with::DisplayFromStr;
26+
use serde_with::serde_as;
2727
use url::Url;
2828

2929
/// Enum containing all versions of the project model.

0 commit comments

Comments
 (0)