Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,5 @@ fecb72464328846dacd0ff8252d105b7818733ab
a6ad2de0484f1910d42793f3ec73b111403099b7
# cargo fmt
b0fbc89c33780ca3e1f2bfeacc67922ee7abe1dc
# Rustfmt 2024
1ce80236261a3cd42a95b1f1abcffede87cafef4
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exclude = [

[workspace.package]
rust-version = "1.86" # MSRV:3
edition = "2021"
edition = "2024"
license = "MIT OR Apache-2.0"
homepage = "https://github.com/rust-lang/cargo"
repository = "https://github.com/rust-lang/cargo"
Expand Down
4 changes: 2 additions & 2 deletions benches/benchsuite/benches/global_cache_tracker.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//! Benchmarks for the global cache tracker.

use cargo::core::global_cache_tracker::{self, DeferredGlobalLastUse, GlobalCacheTracker};
use cargo::util::GlobalContext;
use cargo::util::cache_lock::CacheLockMode;
use cargo::util::interning::InternedString;
use cargo::util::GlobalContext;
use criterion::{criterion_group, criterion_main, Criterion};
use criterion::{Criterion, criterion_group, criterion_main};
use std::fs;
use std::path::{Path, PathBuf};

Expand Down
4 changes: 2 additions & 2 deletions benches/benchsuite/benches/resolve.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use benchsuite::fixtures;
use cargo::GlobalContext;
use cargo::core::compiler::{CompileKind, RustcTargetData};
use cargo::core::resolver::features::{FeatureOpts, FeatureResolver};
use cargo::core::resolver::{CliFeatures, ForceAllTargets, HasDevUnits, ResolveBehavior};
use cargo::core::{PackageIdSpec, Workspace};
use cargo::ops::WorkspaceResolve;
use cargo::GlobalContext;
use criterion::{criterion_group, criterion_main, Criterion};
use criterion::{Criterion, criterion_group, criterion_main};
use std::path::Path;

struct ResolveInfo<'gctx> {
Expand Down
2 changes: 1 addition & 1 deletion benches/benchsuite/benches/workspace_initialization.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use benchsuite::fixtures;
use cargo::core::Workspace;
use criterion::{criterion_group, criterion_main, Criterion};
use criterion::{Criterion, criterion_group, criterion_main};

fn workspace_initialization(c: &mut Criterion) {
let fixtures = fixtures!();
Expand Down
2 changes: 1 addition & 1 deletion benches/benchsuite/src/bin/capture-last-use.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
//! The database is kept in git. It usually shouldn't need to be re-generated
//! unless there is a change in the schema or the benchmark.

use cargo::GlobalContext;
use cargo::core::global_cache_tracker::{self, DeferredGlobalLastUse, GlobalCacheTracker};
use cargo::util::cache_lock::CacheLockMode;
use cargo::GlobalContext;
use rand::prelude::*;
use std::collections::HashMap;
use std::fs;
Expand Down
2 changes: 1 addition & 1 deletion crates/cargo-platform/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cargo-platform"
version = "0.3.0"
version = "0.3.1"
edition.workspace = true
license.workspace = true
rust-version.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions crates/cargo-platform/src/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,11 @@ impl<'a> Parser<'a> {
expected: "a string",
found: t.classify(),
},
))
));
}
Some(Err(e)) => return Err(e),
None => {
return Err(ParseError::new(self.t.orig, IncompleteExpr("a string")))
return Err(ParseError::new(self.t.orig, IncompleteExpr("a string")));
}
};
Cfg::KeyPair(
Expand Down
2 changes: 1 addition & 1 deletion crates/cargo-test-support/src/compare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
use crate::cross_compile::try_alternate;
use crate::paths;
use crate::rustc_host;
use anyhow::{bail, Result};
use anyhow::{Result, bail};
use snapbox::Data;
use snapbox::IntoData;
use std::fmt;
Expand Down
2 changes: 1 addition & 1 deletion crates/cargo-test-support/src/containers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ use std::collections::HashMap;
use std::io::Read;
use std::path::PathBuf;
use std::process::Command;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Mutex;
use std::sync::atomic::{AtomicUsize, Ordering};
use tar::Header;

/// A builder for configuring a container to run.
Expand Down
4 changes: 2 additions & 2 deletions crates/cargo-test-support/src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
//! tags), you can use `git2::Repository::open()` to open the repository and then
//! use some of the helper functions in this file to interact with the repository.

use crate::{paths::CargoPathExt, project, Project, ProjectBuilder, SymlinkBuilder};
use crate::{Project, ProjectBuilder, SymlinkBuilder, paths::CargoPathExt, project};
use std::fs;
use std::path::{Path, PathBuf};
use std::sync::Once;
Expand Down Expand Up @@ -146,7 +146,7 @@ pub fn init(path: &Path) -> git2::Repository {

fn default_search_path() {
use crate::paths::global_root;
use git2::{opts::set_search_path, ConfigLevel};
use git2::{ConfigLevel, opts::set_search_path};

static INIT: Once = Once::new();
INIT.call_once(|| unsafe {
Expand Down
8 changes: 4 additions & 4 deletions crates/cargo-test-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ use std::sync::OnceLock;
use std::thread::JoinHandle;
use std::time::{self, Duration};

use anyhow::{bail, Result};
use cargo_util::{is_ci, ProcessError};
use anyhow::{Result, bail};
use cargo_util::{ProcessError, is_ci};
use snapbox::IntoData as _;
use url::Url;

Expand Down Expand Up @@ -112,11 +112,11 @@ pub mod publish;
pub mod registry;

pub mod prelude {
pub use crate::cargo_test;
pub use crate::paths::CargoPathExt;
pub use crate::ArgLineCommandExt;
pub use crate::ChannelChangerCommandExt;
pub use crate::TestEnvCommandExt;
pub use crate::cargo_test;
pub use crate::paths::CargoPathExt;
pub use snapbox::IntoData;
}

Expand Down
2 changes: 1 addition & 1 deletion crates/cargo-test-support/src/paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ use std::fs;
use std::io::{self, ErrorKind};
use std::path::{Path, PathBuf};
use std::process::Command;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Mutex;
use std::sync::OnceLock;
use std::sync::atomic::{AtomicUsize, Ordering};

static CARGO_INTEGRATION_TEST_DIR: &str = "cit";

Expand Down
4 changes: 2 additions & 2 deletions crates/cargo-test-support/src/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@
//! ```

use crate::compare::InMemoryDir;
use crate::registry::{self, alt_api_path, FeatureMap};
use crate::registry::{self, FeatureMap, alt_api_path};
use flate2::read::GzDecoder;
use snapbox::prelude::*;
use std::collections::HashSet;
use std::fs;
use std::fs::File;
use std::io::{self, prelude::*, SeekFrom};
use std::io::{self, SeekFrom, prelude::*};
use std::path::Path;
use tar::Archive;

Expand Down
4 changes: 2 additions & 2 deletions crates/cargo-test-support/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
use crate::git::repo;
use crate::paths;
use crate::publish::{create_index_line, write_to_index};
use cargo_util::paths::append;
use cargo_util::Sha256;
use flate2::write::GzEncoder;
use cargo_util::paths::append;
use flate2::Compression;
use flate2::write::GzEncoder;
use pasetors::keys::{AsymmetricPublicKey, AsymmetricSecretKey};
use pasetors::paserk::FormatAsPaserk;
use pasetors::token::UntrustedToken;
Expand Down
4 changes: 2 additions & 2 deletions crates/cargo-util-schemas/src/manifest/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,7 @@ impl<'de> de::Deserialize<'de> for TomlDebugInfo {
return Err(serde_untagged::de::Error::invalid_value(
Unexpected::Signed(value),
&expecting,
))
));
}
};
Ok(debuginfo)
Expand All @@ -1167,7 +1167,7 @@ impl<'de> de::Deserialize<'de> for TomlDebugInfo {
return Err(serde_untagged::de::Error::invalid_value(
Unexpected::Str(value),
&expecting,
))
));
}
};
Ok(debuginfo)
Expand Down
4 changes: 2 additions & 2 deletions crates/cargo-util-schemas/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ impl JsonSchema for TomlValueWrapper {
"TomlValue".into()
}

fn json_schema(gen: &mut schemars::SchemaGenerator) -> schemars::Schema {
fn json_schema(generator: &mut schemars::SchemaGenerator) -> schemars::Schema {
// HACK: this is both more and less permissive than `TomlValue` but its close
gen.subschema_for::<serde_json::Value>().into()
generator.subschema_for::<serde_json::Value>().into()
}
}
2 changes: 1 addition & 1 deletion crates/cargo-util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
pub use self::read2::read2;
pub use du::du;
pub use process_builder::ProcessBuilder;
pub use process_error::{exit_status_to_string, is_simple_exit_code, ProcessError};
pub use process_error::{ProcessError, exit_status_to_string, is_simple_exit_code};
pub use sha256::Sha256;

mod du;
Expand Down
2 changes: 1 addition & 1 deletion crates/cargo-util/src/paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ fn exclude_from_content_indexing(path: &Path) {
use std::iter::once;
use std::os::windows::prelude::OsStrExt;
use windows_sys::Win32::Storage::FileSystem::{
GetFileAttributesW, SetFileAttributesW, FILE_ATTRIBUTE_NOT_CONTENT_INDEXED,
FILE_ATTRIBUTE_NOT_CONTENT_INDEXED, GetFileAttributesW, SetFileAttributesW,
};

let path: Vec<u16> = path.as_os_str().encode_wide().chain(once(0)).collect();
Expand Down
6 changes: 3 additions & 3 deletions crates/cargo-util/src/process_builder.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::process_error::ProcessError;
use crate::read2;

use anyhow::{bail, Context, Result};
use anyhow::{Context, Result, bail};
use jobserver::Client;
use shell_escape::escape;
use tempfile::NamedTempFile;
Expand Down Expand Up @@ -564,7 +564,7 @@ fn close_tempfile_and_log_error(file: NamedTempFile) {

#[cfg(unix)]
mod imp {
use super::{close_tempfile_and_log_error, debug_force_argfile, ProcessBuilder, ProcessError};
use super::{ProcessBuilder, ProcessError, close_tempfile_and_log_error, debug_force_argfile};
use anyhow::Result;
use std::io;
use std::os::unix::process::CommandExt;
Expand Down Expand Up @@ -606,9 +606,9 @@ mod imp {
use super::{ProcessBuilder, ProcessError};
use anyhow::Result;
use std::io;
use windows_sys::core::BOOL;
use windows_sys::Win32::Foundation::{FALSE, TRUE};
use windows_sys::Win32::System::Console::SetConsoleCtrlHandler;
use windows_sys::core::BOOL;

unsafe extern "system" fn ctrlc_handler(_: u32) -> BOOL {
// Do nothing; let the child process handle it.
Expand Down
4 changes: 2 additions & 2 deletions crates/cargo-util/src/read2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pub use self::imp::read2;

#[cfg(unix)]
mod imp {
use libc::{c_int, fcntl, F_GETFL, F_SETFL, O_NONBLOCK};
use libc::{F_GETFL, F_SETFL, O_NONBLOCK, c_int, fcntl};
use std::io;
use std::io::prelude::*;
use std::mem;
Expand Down Expand Up @@ -88,9 +88,9 @@ mod imp {
use std::process::{ChildStderr, ChildStdout};
use std::slice;

use miow::Overlapped;
use miow::iocp::{CompletionPort, CompletionStatus};
use miow::pipe::NamedPipe;
use miow::Overlapped;
use windows_sys::Win32::Foundation::ERROR_BROKEN_PIPE;

struct Pipe<'a> {
Expand Down
2 changes: 1 addition & 1 deletion crates/crates-io/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::io::{Cursor, SeekFrom};
use std::time::Instant;

use curl::easy::{Easy, List};
use percent_encoding::{percent_encode, NON_ALPHANUMERIC};
use percent_encoding::{NON_ALPHANUMERIC, percent_encode};
use serde::{Deserialize, Serialize};
use url::Url;

Expand Down
18 changes: 12 additions & 6 deletions crates/home/src/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::slice;

use windows_sys::Win32::Foundation::S_OK;
use windows_sys::Win32::System::Com::CoTaskMemFree;
use windows_sys::Win32::UI::Shell::{FOLDERID_Profile, SHGetKnownFolderPath, KF_FLAG_DONT_VERIFY};
use windows_sys::Win32::UI::Shell::{FOLDERID_Profile, KF_FLAG_DONT_VERIFY, SHGetKnownFolderPath};

pub fn home_dir_inner() -> Option<PathBuf> {
env::var_os("USERPROFILE")
Expand Down Expand Up @@ -46,7 +46,7 @@ fn home_dir_crt() -> Option<PathBuf> {
None
}

extern "C" {
unsafe extern "C" {
fn wcslen(buf: *const u16) -> usize;
}

Expand All @@ -62,17 +62,23 @@ mod tests {
fn test_with_without() {
let olduserprofile = env::var_os("USERPROFILE").unwrap();

env::remove_var("HOME");
env::remove_var("USERPROFILE");
unsafe {
env::remove_var("HOME");
env::remove_var("USERPROFILE");
}

assert_eq!(home_dir_inner(), Some(PathBuf::from(olduserprofile)));

let home = Path::new(r"C:\Users\foo tar baz");

env::set_var("HOME", home.as_os_str());
unsafe {
env::set_var("HOME", home.as_os_str());
}
assert_ne!(home_dir_inner().as_ref().map(Deref::deref), Some(home));

env::set_var("USERPROFILE", home.as_os_str());
unsafe {
env::set_var("USERPROFILE", home.as_os_str());
}
assert_eq!(home_dir_inner().as_ref().map(Deref::deref), Some(home));
}
}
4 changes: 2 additions & 2 deletions crates/mdman/src/format/man.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! Man-page formatter.

use crate::util::{header_text, parse_name_and_section};
use crate::EventIter;
use anyhow::{bail, Error};
use crate::util::{header_text, parse_name_and_section};
use anyhow::{Error, bail};
use pulldown_cmark::{Alignment, Event, HeadingLevel, LinkType, Tag, TagEnd};
use std::fmt::Write;
use url::Url;
Expand Down
4 changes: 2 additions & 2 deletions crates/mdman/src/format/md.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! Markdown formatter.

use crate::util::unwrap;
use crate::ManMap;
use anyhow::{bail, format_err, Error};
use crate::util::unwrap;
use anyhow::{Error, bail, format_err};
use std::fmt::Write;

pub struct MdFormatter {
Expand Down
Loading