Don't trigger an update when looking for suggestions.

This commit is contained in:
Eric Huss 2021-06-21 09:55:29 -07:00
parent a93bfcbdff
commit afe7314ede
2 changed files with 10 additions and 6 deletions

View File

@ -245,12 +245,7 @@ fn render_suggestions(
let mut sources: HashMap<_, _> = source_ids
.into_iter()
.filter_map(|sid| {
let unlocked = sid.clone().with_precise(None);
let mut source = map.load(unlocked, &HashSet::new()).ok()?;
// Ignore errors updating.
if let Err(e) = source.update() {
log::debug!("failed to update source: {:?}", e);
}
let source = map.load(sid, &HashSet::new()).ok()?;
Some((sid, source))
})
.collect();

View File

@ -325,6 +325,15 @@ fn suggestions_for_updates() {
.file("src/lib.rs", "")
.publish();
// This is a hack to force cargo to update the index. Cargo can't do this
// automatically because doing a network update on every build would be a
// bad idea. Under normal circumstances, we'll hope the user has done
// something else along the way to trigger an update (building some other
// project or something). This could use some more consideration of how to
// handle this better (maybe only trigger an update if it hasn't updated
// in a long while?).
p.cargo("update -p without_updates").run();
p.cargo("check -Zfuture-incompat-report")
.masquerade_as_nightly_cargo()
.with_stderr_contains("[..]cargo report future-incompatibilities --id 1[..]")