Skip to content

Commit

Permalink
Rust update - fix build and clippy erorrs (#1213)
Browse files Browse the repository at this point in the history
commit-id:77034927

---

**Stack**:
- #1220
- #1219
- #1218
- #1217
- #1216
- #1215
- #1214
- #1221
- #1222
- #1213⚠️ *Part of a stack created by [spr](https://github.com/ejoffe/spr). Do
not merge manually using the UI - doing so may have unexpected results.*
  • Loading branch information
maciektr authored Mar 22, 2024
1 parent a3c7c16 commit e335f73
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions scarb/src/core/registry/client/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ fn edit_records(records_path: &Path, func: impl FnOnce(&mut IndexRecords)) -> Re
.read(true)
.write(true)
.create(true)
.truncate(false)
.open(records_path)
.context("failed to open file")?;

Expand Down
9 changes: 6 additions & 3 deletions scarb/src/flock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,9 @@ pub struct AdvisoryLock<'f> {
config: &'f Config,
}

#[derive(Debug)]
pub struct AdvisoryLockGuard(Arc<FileLockGuard>);
pub struct AdvisoryLockGuard {
_inner: Arc<FileLockGuard>,
}

impl<'f> AdvisoryLock<'f> {
/// Acquires this advisory lock in an async manner.
Expand All @@ -172,7 +173,9 @@ impl<'f> AdvisoryLock<'f> {
arc
}
};
Ok(AdvisoryLockGuard(file_lock_arc))
Ok(AdvisoryLockGuard {
_inner: file_lock_arc,
})
}
}

Expand Down
1 change: 1 addition & 0 deletions scarb/src/ops/lockfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub fn read_lockfile(ws: &Workspace<'_>) -> Result<Lockfile> {
.read(true)
.write(true)
.create(true)
.truncate(false)
.open(ws.lockfile_path())
.context("failed to open lockfile")?;

Expand Down
5 changes: 4 additions & 1 deletion utils/scarb-build-metadata/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ fn cairo_version() {
.root
.expect("Expected metadata resolve root to be present.");
assert!(
root.repr.starts_with("scarb "),
// The first condition for Rust >= 1.77
// (After the PackageId spec stabilization)
// The second condition for Rust < 1.77
root.repr.contains("scarb#") || root.repr.starts_with("scarb "),
"Expected metadata resolve root to be `scarb`."
);

Expand Down

0 comments on commit e335f73

Please sign in to comment.