Skip to content

Commit 0c4fb75

Browse files
committed
Revert attempt to provide a -Zoffline suggestion if updating fails.
This is just too likely to be a false positive, or otherwise a bad suggestion.
1 parent c2d12c6 commit 0c4fb75

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

src/cargo/sources/registry/remote.rs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ use std::str;
99
use lazycell::LazyCell;
1010
use log::{debug, trace};
1111

12-
use crate::core::{nightly_features_allowed, PackageId, SourceId};
12+
use crate::core::{PackageId, SourceId};
1313
use crate::sources::git;
1414
use crate::sources::registry::MaybeLock;
1515
use crate::sources::registry::{
1616
RegistryConfig, RegistryData, CRATE_TEMPLATE, INDEX_LOCK, VERSION_TEMPLATE,
1717
};
1818
use crate::util::errors::{CargoResult, CargoResultExt};
19-
use crate::util::network::maybe_spurious;
2019
use crate::util::{Config, Sha256};
2120
use crate::util::{FileLock, Filesystem};
2221

@@ -221,18 +220,8 @@ impl<'cfg> RegistryData for RemoteRegistry<'cfg> {
221220
let url = self.source_id.url();
222221
let refspec = "refs/heads/master:refs/remotes/origin/master";
223222
let repo = self.repo.borrow_mut().unwrap();
224-
let result = git::fetch(repo, url, refspec, self.config);
225-
if let Err(e) = result {
226-
let extra = if maybe_spurious(&e) && nightly_features_allowed() && !repo.is_empty()? {
227-
"\nIf the network is unavailable, consider running with the -Zoffline \
228-
flag to run in offline mode."
229-
} else {
230-
""
231-
};
232-
return Err(e
233-
.context(format!("failed to fetch `{}`{}", url, extra))
234-
.into());
235-
}
223+
git::fetch(repo, url, refspec, self.config)
224+
.chain_err(|| format!("failed to fetch `{}`", url))?;
236225
self.config.updated_sources().insert(self.source_id);
237226
Ok(())
238227
}

src/cargo/util/network.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl<'a> Retry<'a> {
3636
}
3737
}
3838

39-
pub fn maybe_spurious(err: &Error) -> bool {
39+
fn maybe_spurious(err: &Error) -> bool {
4040
for e in err.iter_chain() {
4141
if let Some(git_err) = e.downcast_ref::<git2::Error>() {
4242
match git_err.class() {

0 commit comments

Comments
 (0)