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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ unused_qualifications = "warn"
# `dbg!()` and `todo!()` clearly shouldn't make it to production:
dbg_macro = "warn"
todo = "warn"
wildcard_imports = "warn"

[lib]
name = "rustup"
Expand Down
10 changes: 7 additions & 3 deletions src/cli/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@ mod imp {
use std::ptr;

use tracing::info;
use windows_sys::Win32::Foundation::*;
use windows_sys::Win32::System::JobObjects::*;
use windows_sys::Win32::System::Threading::*;
use windows_sys::Win32::Foundation::{CloseHandle, HANDLE};
use windows_sys::Win32::System::JobObjects::{
AssignProcessToJobObject, CreateJobObjectW, JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE,
JOBOBJECT_EXTENDED_LIMIT_INFORMATION, JobObjectExtendedLimitInformation,
SetInformationJobObject,
};
use windows_sys::Win32::System::Threading::GetCurrentProcess;

pub(crate) struct Setup {
job: Handle,
Expand Down
8 changes: 7 additions & 1 deletion src/cli/rustup_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ use crate::{
cli::{
common::{self, PackageUpdate, update_console_filter},
errors::CliError,
help::*,
help::{
completions_help, default_help, doc_help, install_help,
maybe_resolvable_toolchain_arg_help, official_toolchain_arg_help, override_help,
override_unset_help, resolvable_local_toolchain_arg_help,
resolvable_toolchain_arg_help, run_help, rustup_help, show_active_toolchain_help,
show_help, toolchain_help, toolchain_link_help, topic_arg_help, update_help,
},
self_update::{self, SelfUpdateMode, check_rustup_update},
topical_doc,
},
Expand Down
2 changes: 1 addition & 1 deletion src/cli/self_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ use crate::{
DUP_TOOLS, TOOLS,
cli::{
common::{self, Confirm, PackageUpdate, ignorable_error, report_error},
errors::*,
errors::CliError,
markdown::md,
},
config::Cfg,
Expand Down
4 changes: 2 additions & 2 deletions src/cli/self_update/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use windows_registry::{CURRENT_USER, HSTRING, Key};
use windows_result::HRESULT;
use windows_sys::Win32::Foundation::{ERROR_FILE_NOT_FOUND, ERROR_INVALID_DATA};

use super::super::errors::*;
use super::super::errors::CliError;
use super::common;
use super::{InstallOpts, install_bins, report_error};
use crate::cli::markdown::md;
Expand Down Expand Up @@ -460,7 +460,7 @@ pub(crate) fn do_add_to_path(process: &Process) -> Result<()> {

fn _apply_new_path(new_path: Option<HSTRING>) -> Result<()> {
use std::ptr;
use windows_sys::Win32::Foundation::*;
use windows_sys::Win32::Foundation::{LPARAM, WPARAM};
use windows_sys::Win32::UI::WindowsAndMessaging::{
HWND_BROADCAST, SMTO_ABORTIFHUNG, SendMessageTimeoutA, WM_SETTINGCHANGE,
};
Expand Down
6 changes: 3 additions & 3 deletions src/dist/component/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ use tar::EntryType;
use tracing::{error, trace, warn};

use crate::diskio::{CompletedIo, Executor, FileBuffer, IO_CHUNK_SIZE, Item, Kind, get_executor};
use crate::dist::component::components::*;
use crate::dist::component::transaction::*;
use crate::dist::component::components::{ComponentPart, ComponentPartKind, Components};
use crate::dist::component::transaction::Transaction;
use crate::dist::download::DownloadCfg;
use crate::dist::temp;
use crate::errors::*;
use crate::errors::RustupError;
use crate::utils;
use crate::utils::units::Size;

Expand Down
2 changes: 1 addition & 1 deletion src/dist/component/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use tracing::{error, info};

use crate::dist::prefix::InstallPrefix;
use crate::dist::temp;
use crate::errors::*;
use crate::errors::RustupError;
use crate::process::Process;
use crate::utils;

Expand Down
2 changes: 1 addition & 1 deletion src/dist/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use anyhow::{Context, Result};
use serde::{Deserialize, Serialize};

use super::manifest::Component;
use crate::errors::*;
use crate::errors::RustupError;

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct Config {
Expand Down
2 changes: 1 addition & 1 deletion src/dist/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use url::Url;
use crate::config::Cfg;
use crate::dist::temp;
use crate::download::{download_file, download_file_with_resume};
use crate::errors::*;
use crate::errors::RustupError;
use crate::process::Process;
use crate::utils;

Expand Down
4 changes: 2 additions & 2 deletions src/dist/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use serde::{Deserialize, Serialize};

use crate::{
dist::{Profile, TargetTriple, ToolchainDesc, config::Config},
errors::*,
errors::RustupError,
toolchain::DistributableToolchain,
};

Expand Down Expand Up @@ -249,7 +249,7 @@ impl Hash for Component {
}

mod component_target {
use super::*;
use super::{Result, TargetTriple};
use serde::{Deserialize, Deserializer, Serializer};

pub fn serialize<S: Serializer>(
Expand Down
2 changes: 1 addition & 1 deletion src/dist/manifestation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ impl Update {
.components_to_install
.iter()
.filter(|c| {
use crate::dist::manifest::*;
use crate::dist::manifest::{Package, TargetedPackage};
let pkg: Option<&Package> =
new_manifest.get_package(c.short_name_in_manifest()).ok();
let target_pkg: Option<&TargetedPackage> =
Expand Down
2 changes: 1 addition & 1 deletion src/process/file_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ mod test_support {
sync::{Arc, Mutex, MutexGuard},
};

use super::*;
use super::{BufRead, Read, Stdin, StdinLock, io};

// ----------------------- test support for stdin ------------------

Expand Down
2 changes: 1 addition & 1 deletion src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use tracing::info;

use crate::cli::self_update::SelfUpdateMode;
use crate::dist::{AutoInstallMode, Profile};
use crate::errors::*;
use crate::errors::RustupError;
use crate::utils;

#[derive(Clone, Debug, Eq, PartialEq)]
Expand Down
2 changes: 1 addition & 1 deletion src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use retry::{OperationResult, retry};
use tracing::{debug, info, warn};
use url::Url;

use crate::errors::*;
use crate::errors::RustupError;
use crate::process::Process;

#[cfg(not(windows))]
Expand Down
11 changes: 7 additions & 4 deletions src/utils/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,14 @@ pub fn symlink_dir(src: &Path, dest: &Path) -> io::Result<()> {
fn symlink_junction_inner(target: &Path, junction: &Path) -> io::Result<()> {
use std::os::windows::ffi::OsStrExt;
use std::ptr;
use windows_sys::Win32::Foundation::*;
use windows_sys::Win32::Storage::FileSystem::*;
use windows_sys::Win32::System::IO::*;
use windows_sys::Win32::Foundation::GENERIC_WRITE;
use windows_sys::Win32::Storage::FileSystem::{
CreateFileW, FILE_FLAG_BACKUP_SEMANTICS, FILE_FLAG_OPEN_REPARSE_POINT, FILE_SHARE_DELETE,
FILE_SHARE_READ, FILE_SHARE_WRITE, OPEN_EXISTING,
};
use windows_sys::Win32::System::IO::DeviceIoControl;
use windows_sys::Win32::System::Ioctl::FSCTL_SET_REPARSE_POINT;
use windows_sys::Win32::System::SystemServices::*;
use windows_sys::Win32::System::SystemServices::IO_REPARSE_TAG_MOUNT_POINT;

const MAXIMUM_REPARSE_DATA_BUFFER_SIZE: usize = 16 * 1024;

Expand Down