Skip to content

Commit eac1ebc

Browse files
committed
feat: Don't check antivirus in cargo install
1 parent 2f4b47a commit eac1ebc

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/cargo/core/compiler/build_config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ impl CompileMode {
297297
///
298298
/// For example, when a user runs `cargo test`, the intent is [`UserIntent::Test`],
299299
/// but this might result in multiple [`CompileMode`]s for different units.
300-
#[derive(Clone, Copy, Debug)]
300+
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
301301
pub enum UserIntent {
302302
/// Build benchmark binaries, e.g., `cargo bench`
303303
Bench,

src/cargo/ops/cargo_compile/mod.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -564,14 +564,16 @@ where `<compatible-ver>` is the latest version supporting rustc {rustc_version}"
564564
// TODO(madsmtm): Maybe only do this when we have above a certain
565565
// number of build scripts or test binaries to run?
566566

567-
// TODO(madsmtm): We probably don't want to do this check when doing
568-
// `cargo install`?
569-
570567
// TODO(madsmtm): Consider only warning once every X days.
571568

572-
if let Err(err) = detect_antivirus::detect_and_report(gctx) {
573-
// Errors in this detection are not fatal.
574-
tracing::error!("failed detecting whether binaries may be slow to run: {err}");
569+
// We don't want to do this check when installing, since there might
570+
// be `cargo install` users who are not necessarily developers (and so
571+
// the note will be irrelevant to them).
572+
if build_config.intent != UserIntent::Install {
573+
if let Err(err) = detect_antivirus::detect_and_report(gctx) {
574+
// Errors in this detection are not fatal.
575+
tracing::error!("failed detecting whether binaries may be slow to run: {err}");
576+
}
575577
}
576578
}
577579

0 commit comments

Comments
 (0)