Skip to content

Commit 8172f0e

Browse files
committed
fix: Assure gix-submodule works with Rust 1.65.
The previous version of this loop, possibly preferable, ran into a borrow-check issue that was no more from Rust 1.70 onwards.
1 parent 2650843 commit 8172f0e

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

.github/workflows/msrv.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ jobs:
2020
runs-on: ${{ matrix.os }}
2121
steps:
2222
- uses: actions/checkout@v3
23-
- uses: dtolnay/[email protected] # dictated by `windows` crates effectively, IMPORTANT: adjust etc/msrv-badge.svg as well
23+
- uses: dtolnay/[email protected] # dictated by `firefox` to support the `helix` editor, IMPORTANT: adjust etc/msrv-badge.svg as well
2424
- uses: extractions/setup-just@v1
2525
- run: just ci-check-msrv

etc/msrv-badge.svg

Lines changed: 1 addition & 1 deletion
Loading

gix-submodule/src/lib.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,22 +55,20 @@ impl File {
5555

5656
let mut config_to_append = gix_config::File::new(config.meta_owned());
5757
let mut prev_name = None;
58-
let mut section = None;
5958
for ((module_name, field), values) in values {
6059
if prev_name.map_or(true, |pn: &BStr| pn != module_name) {
61-
section.take();
62-
section = Some(
63-
config_to_append
64-
.new_section("submodule", Cow::Owned(module_name.to_owned()))
65-
.expect("all names come from valid configuration, so remain valid"),
66-
);
60+
config_to_append
61+
.new_section("submodule", Cow::Owned(module_name.to_owned()))
62+
.expect("all names come from valid configuration, so remain valid");
6763
prev_name = Some(module_name);
6864
}
69-
let section = section.as_mut().expect("always set at this point");
70-
section.push(
71-
field.try_into().expect("statically known key"),
72-
Some(values.last().expect("at least one value or we wouldn't be here")),
73-
);
65+
config_to_append
66+
.section_mut("submodule", Some(module_name))
67+
.expect("always set at this point")
68+
.push(
69+
field.try_into().expect("statically known key"),
70+
Some(values.last().expect("at least one value or we wouldn't be here")),
71+
);
7472
}
7573

7674
self.config.append(config_to_append);

0 commit comments

Comments
 (0)