Skip to content

Commit 5406630

Browse files
committed
Merge branch 'main' into write-sparse-index (upgrade to Rust 1.65)
2 parents c4e6849 + f2a8a45 commit 5406630

File tree

49 files changed

+109
-79
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+109
-79
lines changed

Diff for: cargo-smart-release/src/bat.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl Support {
3333
return Ok(());
3434
}
3535
if Command::new("bat")
36-
.args(&["--paging=always", "-l=md", "--file-name"])
36+
.args(["--paging=always", "-l=md", "--file-name"])
3737
.arg(format!("{} ({})", path_for_title.display(), additional_title.as_ref()))
3838
.arg(path)
3939
.status()?

Diff for: cargo-smart-release/src/changelog/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ impl Section {
108108
return false;
109109
};
110110
segments.iter().any(
111-
|s| matches!(s, section::Segment::Conventional(section::segment::Conventional {kind, removed, is_breaking, ..}) if *is_breaking && removed.is_empty() && as_headline(*kind).is_none()),
111+
|s| matches!(s, section::Segment::Conventional(section::segment::Conventional {kind, removed, is_breaking, ..}) if *is_breaking && removed.is_empty() && as_headline(kind).is_none()),
112112
)
113113
}
114114
}

Diff for: cargo-smart-release/src/changelog/parse.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ fn parse_conventional_to_next_section_title(
246246
]
247247
.iter()
248248
.find(|kind| {
249-
let headline = section::segment::conventional::as_headline(*kind).unwrap_or(*kind);
249+
let headline = section::segment::conventional::as_headline(kind).unwrap_or(*kind);
250250
let common_len = headline.len().min(title.len());
251251
title
252252
.get(..common_len)
@@ -256,7 +256,7 @@ fn parse_conventional_to_next_section_title(
256256
.expect("BUG: this list needs an update too if new kinds of conventional messages are added");
257257

258258
let mut conventional = section::segment::Conventional {
259-
kind: *kind,
259+
kind,
260260
is_breaking,
261261
removed: vec![],
262262
messages: vec![],

Diff for: cargo-smart-release/src/command/release/manifest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ fn generate_commit_message(
340340
match (
341341
pending_changelogs.len(),
342342
pending_changelogs.iter().fold(0usize, |mut acc, (_, _, lock)| {
343-
acc += if !lock.resource_path().is_file() { 1 } else { 0 };
343+
acc += usize::from(!lock.resource_path().is_file());
344344
acc
345345
})
346346
) {

Diff for: cargo-smart-release/src/command/release/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ fn perform_release(ctx: &Context, options: Options, crates: &[traverse::Dependen
416416
let prevent_default_members = ctx.base.meta.workspace_members.len() > 1;
417417
for (publishee, new_version) in crates.iter().filter_map(try_to_published_crate_and_new_version) {
418418
if let Some((crate_, version)) = successful_publishees_and_version.last() {
419-
if let Err(err) = wait_for_release(*crate_, version, options) {
419+
if let Err(err) = wait_for_release(crate_, version, options) {
420420
log::warn!(
421421
"Failed to wait for crates-index update - trying to publish '{} v{}' anyway: {}.",
422422
publishee.name,

Diff for: git-config-value/tests/value/boolean.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fn ignores_case() {
3030
// Random subset
3131
for word in &["no", "yes", "on", "off", "true", "false"] {
3232
let first: bool = Boolean::try_from(b(word)).unwrap().into();
33-
let second: bool = Boolean::try_from(b(&*word.to_uppercase())).unwrap().into();
33+
let second: bool = Boolean::try_from(b(&word.to_uppercase())).unwrap().into();
3434
assert_eq!(first, second);
3535
}
3636
}

Diff for: git-config/src/file/access/read_only.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ impl<'event> File<'event> {
264264
///
265265
/// This is the metadata the file was instantiated with for use in all newly created sections.
266266
pub fn meta(&self) -> &Metadata {
267-
&*self.meta
267+
&self.meta
268268
}
269269

270270
/// Similar to [`meta()`][File::meta()], but with shared ownership.

Diff for: git-config/tests/file/mod.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ pub fn cow_str(s: &str) -> Cow<'_, BStr> {
88

99
#[test]
1010
fn size_in_memory() {
11-
assert_eq!(
12-
std::mem::size_of::<git_config::File<'_>>(),
13-
1040,
14-
"This shouldn't change without us noticing"
11+
let actual = std::mem::size_of::<git_config::File<'_>>();
12+
assert!(
13+
actual <= 1040,
14+
"{} <= 1040: This shouldn't change without us noticing",
15+
actual
1516
);
1617
}
1718

Diff for: git-config/tests/parse/mod.rs

+15-12
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,23 @@ mod section;
99

1010
#[test]
1111
fn size_in_memory() {
12-
assert_eq!(
13-
std::mem::size_of::<Section<'_>>(),
14-
6768,
15-
"This shouldn't change without us noticing"
12+
let actual = std::mem::size_of::<Section<'_>>();
13+
assert!(
14+
actual <= 6768,
15+
"{} <= 6768: This shouldn't change without us noticing",
16+
actual
1617
);
17-
assert_eq!(
18-
std::mem::size_of::<Event<'_>>(),
19-
104,
20-
"This shouldn't change without us noticing"
18+
let actual = std::mem::size_of::<Event<'_>>();
19+
assert!(
20+
actual <= 104,
21+
"{} <= 104: This shouldn't change without us noticing",
22+
actual
2123
);
22-
assert_eq!(
23-
std::mem::size_of::<Events<'_>>(),
24-
872,
25-
"This shouldn't change without us noticing"
24+
let actual = std::mem::size_of::<Events<'_>>();
25+
assert!(
26+
actual <= 872,
27+
"{} <= 872: This shouldn't change without us noticing",
28+
actual
2629
);
2730
}
2831

Diff for: git-config/tests/value/normalize.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ fn all_quote_optimization_is_correct() {
4242
#[test]
4343
fn quotes_right_next_to_each_other() {
4444
let cow = normalize_bstr("\"hello\"\" world\"");
45-
assert_eq!(cow, cow_str("hello world").to_owned());
45+
assert_eq!(cow, cow_str("hello world").clone());
4646
assert!(matches!(cow, Cow::Owned(_)));
4747
}
4848

4949
#[test]
5050
fn escaped_quotes_are_kept() {
5151
let cow = normalize_bstr(r#""hello \"\" world""#);
52-
assert_eq!(cow, cow_str("hello \"\" world").to_owned(),);
52+
assert_eq!(cow, cow_str("hello \"\" world").clone(),);
5353
assert!(matches!(cow, Cow::Owned(_)));
5454
}
5555

Diff for: git-credentials/src/helper/cascade.rs

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ impl Cascade {
5959
///
6060
/// When _getting_ credentials, all programs are asked until the credentials are complete, stopping the cascade.
6161
/// When _storing_ or _erasing_ all programs are instructed in order.
62+
#[allow(clippy::result_large_err)]
6263
pub fn invoke(&mut self, mut action: helper::Action, mut prompt: git_prompt::Options<'_>) -> protocol::Result {
6364
let mut url = action
6465
.context_mut()

Diff for: git-credentials/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ pub mod protocol;
3434
/// contain only the URL to kick off the process, or should be created by [`helper::NextAction`].
3535
///
3636
/// If more control is required, use the [`Cascade`][helper::Cascade] type.
37+
#[allow(clippy::result_large_err)]
3738
pub fn builtin(action: helper::Action) -> protocol::Result {
3839
protocol::helper_outcome_to_result(
3940
helper::invoke(&mut Program::from_kind(program::Kind::Builtin), &action)?,

Diff for: git-credentials/src/protocol/context/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ mod mutate {
5454
/// Destructure the url at our `url` field into parts like protocol, host, username and path and store
5555
/// them in our respective fields. If `use_http_path` is set, http paths are significant even though
5656
/// normally this isn't the case.
57+
#[allow(clippy::result_large_err)]
5758
pub fn destructure_url_in_place(&mut self, use_http_path: bool) -> Result<&mut Self, protocol::Error> {
5859
let url = git_url::parse(self.url.as_ref().ok_or(protocol::Error::UrlMissing)?.as_ref())?;
5960
self.protocol = Some(url.scheme.as_str().into());

Diff for: git-credentials/src/protocol/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ pub struct Context {
5757
}
5858

5959
/// Convert the outcome of a helper invocation to a helper result, assuring that the identity is complete in the process.
60+
#[allow(clippy::result_large_err)]
6061
pub fn helper_outcome_to_result(outcome: Option<helper::Outcome>, action: helper::Action) -> Result {
6162
fn redact(mut ctx: Context) -> Context {
6263
if let Some(pw) = ctx.password.as_mut() {

Diff for: git-credentials/tests/helper/cascade.rs

+1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ mod invoke {
124124
}
125125
}
126126

127+
#[allow(clippy::result_large_err)]
127128
fn invoke_cascade<'a>(names: impl IntoIterator<Item = &'a str>, action: Action) -> protocol::Result {
128129
Cascade::default().use_http_path(true).extend(fixtures(names)).invoke(
129130
action,

Diff for: git-diff/src/tree/visit.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,11 @@ mod tests {
7878

7979
#[test]
8080
fn size_of_change() {
81-
assert_eq!(
82-
std::mem::size_of::<Change>(),
83-
46,
84-
"this type shouldn't grow without us knowing"
81+
let actual = std::mem::size_of::<Change>();
82+
assert!(
83+
actual <= 46,
84+
"{} <= 46: this type shouldn't grow without us knowing",
85+
actual
8586
)
8687
}
8788
}

Diff for: git-discover/tests/is_git/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fn verify_on_exfat() -> crate::Result<()> {
1111
let _cleanup = {
1212
// Mount dmg file
1313
Command::new("hdiutil")
14-
.args(&["attach", "-nobrowse", "-mountpoint"])
14+
.args(["attach", "-nobrowse", "-mountpoint"])
1515
.arg(mount_point.path())
1616
.arg(fixtures.as_path().join("exfat_repo.dmg"))
1717
.status()?;

Diff for: git-discover/tests/upwards/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -209,14 +209,14 @@ fn cross_fs() -> crate::Result {
209209
let dmg_location = tempfile::tempdir()?;
210210
let dmg_file = dmg_location.path().join("temp.dmg");
211211
Command::new("hdiutil")
212-
.args(&["create", "-size", "1m"])
212+
.args(["create", "-size", "1m"])
213213
.arg(&dmg_file)
214214
.status()?;
215215

216216
// Mount dmg file into temporary location
217217
let mount_point = tempfile::tempdir()?;
218218
Command::new("hdiutil")
219-
.args(&["attach", "-nobrowse", "-mountpoint"])
219+
.args(["attach", "-nobrowse", "-mountpoint"])
220220
.arg(mount_point.path())
221221
.arg(&dmg_file)
222222
.status()?;

Diff for: git-glob/tests/wildmatch/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ fn corpus() {
219219
} else if actual != expected {
220220
failures.push((pattern, pattern_text, text, actual, expected));
221221
} else {
222-
at_least_one_panic += if actual.any_panicked() { 1 } else { 0 };
222+
at_least_one_panic += i32::from(actual.any_panicked());
223223
}
224224
}
225225

Diff for: git-index/src/extension/tree/verify.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl Tree {
7272
prev = Some(child);
7373
}
7474
if let Some(buf) = find_buf.as_mut() {
75-
let tree_entries = find(&parent_id, *buf).ok_or(Error::TreeNodeNotFound { oid: parent_id })?;
75+
let tree_entries = find(&parent_id, buf).ok_or(Error::TreeNodeNotFound { oid: parent_id })?;
7676
let mut num_entries = 0;
7777
for entry in tree_entries
7878
.filter_map(Result::ok)

Diff for: git-object/src/object/mod.rs

+11
Original file line numberDiff line numberDiff line change
@@ -95,27 +95,38 @@ impl Object {
9595
}
9696
}
9797
/// Turns this instance into a [`Blob`][Blob] if it is one.
98+
#[allow(clippy::result_large_err)]
9899
pub fn try_into_blob(self) -> Result<Blob, Self> {
99100
match self {
100101
Object::Blob(v) => Ok(v),
101102
_ => Err(self),
102103
}
103104
}
105+
/// Turns this instance into a [`BlobRef`][BlobRef] if it is a blob.
106+
pub fn try_into_blob_ref(&self) -> Option<BlobRef<'_>> {
107+
match self {
108+
Object::Blob(v) => Some(v.to_ref()),
109+
_ => None,
110+
}
111+
}
104112
/// Turns this instance into a [`Commit`][Commit] if it is one.
113+
#[allow(clippy::result_large_err)]
105114
pub fn try_into_commit(self) -> Result<Commit, Self> {
106115
match self {
107116
Object::Commit(v) => Ok(v),
108117
_ => Err(self),
109118
}
110119
}
111120
/// Turns this instance into a [`Tree`][Tree] if it is one.
121+
#[allow(clippy::result_large_err)]
112122
pub fn try_into_tree(self) -> Result<Tree, Self> {
113123
match self {
114124
Object::Tree(v) => Ok(v),
115125
_ => Err(self),
116126
}
117127
}
118128
/// Turns this instance into a [`Tag`][Tag] if it is one.
129+
#[allow(clippy::result_large_err)]
119130
pub fn try_into_tag(self) -> Result<Tag, Self> {
120131
match self {
121132
Object::Tag(v) => Ok(v),

Diff for: git-object/tests/object.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ fn fixture_bytes(path: &str) -> Vec<u8> {
3030

3131
#[test]
3232
fn size_in_memory() {
33-
assert_eq!(
34-
std::mem::size_of::<git_object::Object>(),
35-
264,
36-
"Prevent unexpected growth of what should be lightweight objects"
33+
let actual = std::mem::size_of::<git_object::Object>();
34+
assert!(
35+
actual <= 264,
36+
"{} <= 264: Prevent unexpected growth of what should be lightweight objects",
37+
actual
3738
)
3839
}

Diff for: git-odb/src/find.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ impl PotentialPrefix {
1717
/// matching this prefix.
1818
pub fn new(id: impl Into<git_hash::ObjectId>, hex_len: usize) -> Result<Self, git_hash::prefix::Error> {
1919
let id = id.into();
20-
git_hash::Prefix::new(&id, hex_len)?;
20+
git_hash::Prefix::new(id, hex_len)?;
2121
Ok(PotentialPrefix { id, hex_len })
2222
}
2323

Diff for: git-odb/src/store_impls/dynamic/find.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ mod error {
7979

8080
#[test]
8181
fn error_size() {
82-
assert_eq!(std::mem::size_of::<Error>(), 88, "should not grow without us noticing");
82+
let actual = std::mem::size_of::<Error>();
83+
assert!(actual <= 88, "{} <= 88: should not grow without us noticing", actual);
8384
}
8485
}
8586
}

Diff for: git-odb/src/store_impls/dynamic/handle.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ pub(crate) mod index_lookup {
178178
},
179179
pack_offset: index.pack_offset_at_index(idx),
180180
},
181-
index_file: IntraPackLookup::Single(&**index),
181+
index_file: IntraPackLookup::Single(index),
182182
pack: data,
183183
}),
184184
handle::SingleOrMultiIndex::Multi { index, data } => index.lookup(object_id).map(move |idx| {
@@ -192,7 +192,7 @@ pub(crate) mod index_lookup {
192192
pack_offset,
193193
},
194194
index_file: IntraPackLookup::Multi {
195-
index: &**index,
195+
index,
196196
required_pack_index: pack_index,
197197
},
198198
pack: &mut data[pack_index as usize],
@@ -309,7 +309,7 @@ where
309309

310310
/// Return a shared reference to the contained store.
311311
pub fn store_ref(&self) -> &S::Target {
312-
&*self.store
312+
&self.store
313313
}
314314

315315
/// Return an owned store with shared ownership.

Diff for: git-odb/src/store_impls/dynamic/metrics.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,9 @@ impl super::Store {
5353
if bundle.is_disposable() {
5454
unreachable_indices += 1;
5555
unreachable_packs += match bundle {
56-
IndexAndPacks::Index(single) => {
57-
if single.data.is_loaded() {
58-
1
59-
} else {
60-
0
61-
}
62-
}
56+
IndexAndPacks::Index(single) => usize::from(single.data.is_loaded()),
6357
IndexAndPacks::MultiIndex(multi) => {
64-
multi.data.iter().map(|p| if p.is_loaded() { 1 } else { 0 }).sum()
58+
multi.data.iter().map(|p| usize::from(p.is_loaded())).sum()
6559
}
6660
}
6761
}

Diff for: git-odb/src/store_impls/dynamic/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ pub(crate) enum OnDiskFileState<T: Clone> {
148148

149149
impl<T: Clone> OnDiskFile<T> {
150150
pub fn path(&self) -> &Path {
151-
&*self.path
151+
&self.path
152152
}
153153
/// Return true if we hold a memory map of the file already.
154154
pub fn is_loaded(&self) -> bool {

Diff for: git-prompt/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ mod imp {
2727
/// Ask the user given a `prompt`, returning the result.
2828
pub fn ask(prompt: &str, opts: &Options<'_>) -> Result<String, Error> {
2929
if let Some(askpass) = opts.askpass.as_deref() {
30-
match git_command::prepare(askpass).arg(&prompt).spawn() {
30+
match git_command::prepare(askpass).arg(prompt).spawn() {
3131
Ok(cmd) => {
3232
if let Some(mut stdout) = cmd
3333
.wait_with_output()

Diff for: git-protocol/src/fetch/handshake.rs

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ pub(crate) mod function {
4747
/// turns out to be required. `extra_parameters` are the parameters `(name, optional value)` to add to the handshake,
4848
/// each time it is performed in case authentication is required.
4949
/// `progress` is used to inform about what's currently happening.
50+
#[allow(clippy::result_large_err)]
5051
#[maybe_async]
5152
pub async fn handshake<AuthFn, T>(
5253
mut transport: T,

Diff for: git-protocol/src/fetch_fn.rs

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ impl Default for FetchConnection {
4343
/// * `progress` is used to emit progress messages.
4444
///
4545
/// _Note_ that depending on the `delegate`, the actual action performed can be `ls-refs`, `clone` or `fetch`.
46+
#[allow(clippy::result_large_err)]
4647
#[maybe_async]
4748
pub async fn fetch<F, D, T, P>(
4849
mut transport: T,

0 commit comments

Comments
 (0)