Skip to content

Commit d091c78

Browse files
committed
fix!: File::push_section() is now infallible.
Previously it used a `Result` even though it couldn't fail anywhere.
1 parent 0a584ee commit d091c78

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

gix-config/src/file/access/mutate.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -272,17 +272,13 @@ impl<'event> File<'event> {
272272
self.sections.remove(&id)
273273
}
274274

275-
/// Adds the provided section to the config, returning a mutable reference
276-
/// to it for immediate editing.
275+
/// Adds the provided `section` to the config, returning a mutable reference to it for immediate editing.
277276
/// Note that its meta-data will remain as is.
278-
pub fn push_section(
279-
&mut self,
280-
section: file::Section<'event>,
281-
) -> Result<SectionMut<'_, 'event>, section::header::Error> {
277+
pub fn push_section(&mut self, section: file::Section<'event>) -> SectionMut<'_, 'event> {
282278
let id = self.push_section_internal(section);
283279
let nl = self.detect_newline_style_smallvec();
284280
let section = self.sections.get_mut(&id).expect("each id yields a section").to_mut(nl);
285-
Ok(section)
281+
section
286282
}
287283

288284
/// Renames the section with `name` and `subsection_name`, modifying the last matching section

0 commit comments

Comments
 (0)