diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 33e06272ff1a225ba5e9fb1bdb8a12c3d9f78a64_cnVzdC9DYXJnby50b21s..c4392e8bfb9fcf199c5999536547d3a5718be40e_cnVzdC9DYXJnby50b21s 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -2,3 +2,6 @@ members = ["hg-core", "hg-cpython", "hg-pyo3", "rhg", "pyo3-sharedref"] exclude = ["chg", "hgcli"] resolver = "2" + +[workspace.lints.clippy] +or_fun_call = "deny" diff --git a/rust/hg-core/Cargo.toml b/rust/hg-core/Cargo.toml index 33e06272ff1a225ba5e9fb1bdb8a12c3d9f78a64_cnVzdC9oZy1jb3JlL0NhcmdvLnRvbWw=..c4392e8bfb9fcf199c5999536547d3a5718be40e_cnVzdC9oZy1jb3JlL0NhcmdvLnRvbWw= 100644 --- a/rust/hg-core/Cargo.toml +++ b/rust/hg-core/Cargo.toml @@ -5,6 +5,9 @@ description = "Mercurial pure Rust core library, with no assumption on Python bindings (FFI)" edition = "2021" +[lints] +workspace = true + [lib] name = "hg" diff --git a/rust/hg-core/src/revlog/index.rs b/rust/hg-core/src/revlog/index.rs index 33e06272ff1a225ba5e9fb1bdb8a12c3d9f78a64_cnVzdC9oZy1jb3JlL3NyYy9yZXZsb2cvaW5kZXgucnM=..c4392e8bfb9fcf199c5999536547d3a5718be40e_cnVzdC9oZy1jb3JlL3NyYy9yZXZsb2cvaW5kZXgucnM= 100644 --- a/rust/hg-core/src/revlog/index.rs +++ b/rust/hg-core/src/revlog/index.rs @@ -880,9 +880,9 @@ if parent_base.0 == p1.0 { break; } - p1 = self.check_revision(parent_base).ok_or( - RevlogError::InvalidRevision(parent_base.to_string()), - )?; + p1 = self.check_revision(parent_base).ok_or_else(|| { + RevlogError::InvalidRevision(parent_base.to_string()) + })?; } while let Some(p2_entry) = self.get_entry(p2) { if p2_entry.compressed_len() != 0 || p2.0 == 0 { @@ -893,10 +893,10 @@ if parent_base.0 == p2.0 { break; } - p2 = self.check_revision(parent_base).ok_or( - RevlogError::InvalidRevision(parent_base.to_string()), - )?; + p2 = self.check_revision(parent_base).ok_or_else(|| { + RevlogError::InvalidRevision(parent_base.to_string()) + })?; } if base == p1.0 || base == p2.0 { return Ok(false); } @@ -899,10 +899,10 @@ } if base == p1.0 || base == p2.0 { return Ok(false); } - rev = self - .check_revision(base.into()) - .ok_or(RevlogError::InvalidRevision(base.to_string()))?; + rev = self.check_revision(base.into()).ok_or_else(|| { + RevlogError::InvalidRevision(base.to_string()) + })?; } Ok(rev == NULL_REVISION) } diff --git a/rust/hg-core/src/revlog/mod.rs b/rust/hg-core/src/revlog/mod.rs index 33e06272ff1a225ba5e9fb1bdb8a12c3d9f78a64_cnVzdC9oZy1jb3JlL3NyYy9yZXZsb2cvbW9kLnJz..c4392e8bfb9fcf199c5999536547d3a5718be40e_cnVzdC9oZy1jb3JlL3NyYy9yZXZsb2cvbW9kLnJz 100644 --- a/rust/hg-core/src/revlog/mod.rs +++ b/rust/hg-core/src/revlog/mod.rs @@ -374,7 +374,9 @@ nodemap .find_bin(self.index(), node) .map_err(|err| (err, format!("{:x}", node)))? - .ok_or(RevlogError::InvalidRevision(format!("{:x}", node))) + .ok_or_else(|| { + RevlogError::InvalidRevision(format!("{:x}", node)) + }) } else { self.index().rev_from_node_no_persistent_nodemap(node) } diff --git a/rust/hg-cpython/Cargo.toml b/rust/hg-cpython/Cargo.toml index 33e06272ff1a225ba5e9fb1bdb8a12c3d9f78a64_cnVzdC9oZy1jcHl0aG9uL0NhcmdvLnRvbWw=..c4392e8bfb9fcf199c5999536547d3a5718be40e_cnVzdC9oZy1jcHl0aG9uL0NhcmdvLnRvbWw= 100644 --- a/rust/hg-cpython/Cargo.toml +++ b/rust/hg-cpython/Cargo.toml @@ -4,6 +4,9 @@ authors = ["Georges Racinet <gracinet@anybox.fr>"] edition = "2021" +[lints] +workspace = true + [lib] name='rusthg' crate-type = ["cdylib"] diff --git a/rust/hg-pyo3/Cargo.toml b/rust/hg-pyo3/Cargo.toml index 33e06272ff1a225ba5e9fb1bdb8a12c3d9f78a64_cnVzdC9oZy1weW8zL0NhcmdvLnRvbWw=..c4392e8bfb9fcf199c5999536547d3a5718be40e_cnVzdC9oZy1weW8zL0NhcmdvLnRvbWw= 100644 --- a/rust/hg-pyo3/Cargo.toml +++ b/rust/hg-pyo3/Cargo.toml @@ -3,6 +3,9 @@ version = "0.1.0" edition = "2021" +[lints] +workspace = true + [lib] name='rusthgpyo3' crate-type = ["cdylib"] diff --git a/rust/pyo3-sharedref/Cargo.toml b/rust/pyo3-sharedref/Cargo.toml index 33e06272ff1a225ba5e9fb1bdb8a12c3d9f78a64_cnVzdC9weW8zLXNoYXJlZHJlZi9DYXJnby50b21s..c4392e8bfb9fcf199c5999536547d3a5718be40e_cnVzdC9weW8zLXNoYXJlZHJlZi9DYXJnby50b21s 100644 --- a/rust/pyo3-sharedref/Cargo.toml +++ b/rust/pyo3-sharedref/Cargo.toml @@ -3,6 +3,9 @@ version = "0.1.0" edition = "2021" +[lints] +workspace = true + [lib] name='pyo3_sharedref' diff --git a/rust/rhg/Cargo.toml b/rust/rhg/Cargo.toml index 33e06272ff1a225ba5e9fb1bdb8a12c3d9f78a64_cnVzdC9yaGcvQ2FyZ28udG9tbA==..c4392e8bfb9fcf199c5999536547d3a5718be40e_cnVzdC9yaGcvQ2FyZ28udG9tbA== 100644 --- a/rust/rhg/Cargo.toml +++ b/rust/rhg/Cargo.toml @@ -7,6 +7,9 @@ ] edition = "2021" +[lints] +workspace = true + [dependencies] hg-core = { path = "../hg-core"} chrono = "0.4.23"