compatibility with Rust 1.71
Unified · Split
| @@ -158,7 +158,7 @@ impl LineStats { · 157 unmodified lines | |||
| 158 | /// An index able to address any commit | 158 | /// An index able to address any commit |
| 159 | pub type CommitIdx = u32; | 159 | pub type CommitIdx = u32; |
| 160 | 160 | ||
| 161 | pub fn add_lines(line_stats: bool, lines_counter: Option<&AtomicUsize>, mut lines: &mut LineStats, id: gix::Id<'_>) { | 161 | pub fn add_lines(line_stats: bool, lines_counter: Option<&AtomicUsize>, lines: &mut LineStats, id: gix::Id<'_>) { |
| 162 | if let Some(Ok(blob)) = line_stats.then(|| id.object()) { | 162 | if let Some(Ok(blob)) = line_stats.then(|| id.object()) { |
| 163 | let nl = blob.data.lines_with_terminator().count(); | 163 | let nl = blob.data.lines_with_terminator().count(); |
| 164 | lines.added += nl; | 164 | lines.added += nl; |
| @@ -168,7 +168,7 @@ pub fn add_lines(line_stats: bool, lines_counter: Option<&AtomicUsize>, mut line · 3 unmodified lines | |||
| 168 | } | 168 | } |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | pub fn remove_lines(line_stats: bool, lines_counter: Option<&AtomicUsize>, mut lines: &mut LineStats, id: gix::Id<'_>) { | 171 | pub fn remove_lines(line_stats: bool, lines_counter: Option<&AtomicUsize>, lines: &mut LineStats, id: gix::Id<'_>) { |
| 172 | if let Some(Ok(blob)) = line_stats.then(|| id.object()) { | 172 | if let Some(Ok(blob)) = line_stats.then(|| id.object()) { |
| 173 | let nl = blob.data.lines_with_terminator().count(); | 173 | let nl = blob.data.lines_with_terminator().count(); |
| 174 | lines.removed += nl; | 174 | lines.removed += nl; |
| @@ -20,8 +20,7 @@ impl<'event> File<'event> { · 19 unmodified lines | |||
| 20 | ) -> Result<SectionMut<'a, 'event>, lookup::existing::Error> { | 20 | ) -> Result<SectionMut<'a, 'event>, lookup::existing::Error> { |
| 21 | let id = self | 21 | let id = self |
| 22 | .section_ids_by_name_and_subname(name.as_ref(), subsection_name)? | 22 | .section_ids_by_name_and_subname(name.as_ref(), subsection_name)? |
| 23 | .rev() | 23 | .next_back() |
| 24 | .next() | ||
| 25 | .expect("BUG: Section lookup vec was empty"); | 24 | .expect("BUG: Section lookup vec was empty"); |
| 26 | let nl = self.detect_newline_style_smallvec(); | 25 | let nl = self.detect_newline_style_smallvec(); |
| 27 | Ok(self | 26 | Ok(self |
| @@ -212,8 +211,7 @@ impl<'event> File<'event> { · 184 unmodified lines | |||
| 212 | let id = self | 211 | let id = self |
| 213 | .section_ids_by_name_and_subname(name, subsection_name.into()) | 212 | .section_ids_by_name_and_subname(name, subsection_name.into()) |
| 214 | .ok()? | 213 | .ok()? |
| 215 | .rev() | 214 | .next_back()?; |
| 216 | .next()?; | ||
| 217 | self.remove_section_by_id(id) | 215 | self.remove_section_by_id(id) |
| 218 | } | 216 | } |
| 219 | 217 | ||
| @@ -298,8 +296,7 @@ impl<'event> File<'event> { · 78 unmodified lines | |||
| 298 | ) -> Result<(), rename_section::Error> { | 296 | ) -> Result<(), rename_section::Error> { |
| 299 | let id = self | 297 | let id = self |
| 300 | .section_ids_by_name_and_subname(name.as_ref(), subsection_name.into())? | 298 | .section_ids_by_name_and_subname(name.as_ref(), subsection_name.into())? |
| 301 | .rev() | 299 | .next_back() |
| 302 | .next() | ||
| 303 | .expect("list of sections were empty, which violates invariant"); | 300 | .expect("list of sections were empty, which violates invariant"); |
| 304 | let section = self.sections.get_mut(&id).expect("known section-id"); | 301 | let section = self.sections.get_mut(&id).expect("known section-id"); |
| 305 | section.header = section::Header::new(new_name, new_subsection_name)?; | 302 | section.header = section::Header::new(new_name, new_subsection_name)?; |
| @@ -74,7 +74,7 @@ impl<'a> Whitespace<'a> { · 73 unmodified lines | |||
| 74 | .find_map(|(idx, e)| matches!(e, Event::SectionKey(_)).then(|| idx)); | 74 | .find_map(|(idx, e)| matches!(e, Event::SectionKey(_)).then(|| idx)); |
| 75 | key_pos | 75 | key_pos |
| 76 | .map(|key_pos| { | 76 | .map(|key_pos| { |
| 77 | let pre_key = s.0[..key_pos].iter().rev().next().and_then(|e| match e { | 77 | let pre_key = s.0[..key_pos].iter().next_back().and_then(|e| match e { |
| 78 | Event::Whitespace(s) => Some(s.clone()), | 78 | Event::Whitespace(s) => Some(s.clone()), |
| 79 | _ => None, | 79 | _ => None, |
| 80 | }); | 80 | }); |
| @@ -55,7 +55,7 @@ mod path { · 54 unmodified lines | |||
| 55 | ) -> Option<Self> { | 55 | ) -> Option<Self> { |
| 56 | let cwd = current_dir.as_ref(); | 56 | let cwd = current_dir.as_ref(); |
| 57 | let normalize_on_trailing_dot_dot = |dir: PathBuf| -> Option<PathBuf> { | 57 | let normalize_on_trailing_dot_dot = |dir: PathBuf| -> Option<PathBuf> { |
| 58 | if !matches!(dir.components().rev().next(), Some(std::path::Component::ParentDir)) { | 58 | if !matches!(dir.components().next_back(), Some(std::path::Component::ParentDir)) { |
| 59 | dir | 59 | dir |
| 60 | } else { | 60 | } else { |
| 61 | gix_path::normalize(&dir, cwd)?.into_owned() | 61 | gix_path::normalize(&dir, cwd)?.into_owned() |
| @@ -43,7 +43,7 @@ mod memory { · 42 unmodified lines | |||
| 43 | MemoryCappedHashmap { | 43 | MemoryCappedHashmap { |
| 44 | inner: clru::CLruCache::with_config( | 44 | inner: clru::CLruCache::with_config( |
| 45 | clru::CLruCacheConfig::new(NonZeroUsize::new(memory_cap_in_bytes).expect("non zero")) | 45 | clru::CLruCacheConfig::new(NonZeroUsize::new(memory_cap_in_bytes).expect("non zero")) |
| 46 | .with_hasher(gix_hashtable::hash::Builder::default()) | 46 | .with_hasher(gix_hashtable::hash::Builder) |
| 47 | .with_scale(CustomScale), | 47 | .with_scale(CustomScale), |
| 48 | ), | 48 | ), |
| 49 | free_list: Vec::new(), | 49 | free_list: Vec::new(), |
| @@ -21,7 +21,7 @@ where · 20 unmodified lines | |||
| 21 | total: Default::default(), | 21 | total: Default::default(), |
| 22 | counts: Default::default(), | 22 | counts: Default::default(), |
| 23 | progress, | 23 | progress, |
| 24 | _err: PhantomData::default(), | 24 | _err: PhantomData, |
| 25 | } | 25 | } |
| 26 | } | 26 | } |
| 27 | } | 27 | } |
| @@ -288,7 +288,7 @@ mod reduce { · 287 unmodified lines | |||
| 288 | fn default() -> Self { | 288 | fn default() -> Self { |
| 289 | Statistics { | 289 | Statistics { |
| 290 | total: Default::default(), | 290 | total: Default::default(), |
| 291 | _err: PhantomData::default(), | 291 | _err: PhantomData, |
| 292 | } | 292 | } |
| 293 | } | 293 | } |
| 294 | } | 294 | } |
| @@ -86,10 +86,7 @@ pub use traits::IsSpuriousError; · 85 unmodified lines | |||
| 86 | pub mod client; | 86 | pub mod client; |
| 87 | 87 | ||
| 88 | #[doc(inline)] | 88 | #[doc(inline)] |
| 89 | #[cfg(any( | 89 | #[cfg(any(feature = "blocking-client", all(feature = "async-client", feature = "async-std")))] |
| 90 | feature = "blocking-client", | ||
| 91 | all(feature = "async-client", any(feature = "async-std")) | ||
| 92 | ))] | ||
| 93 | pub use client::connect; | 90 | pub use client::connect; |
| 94 | 91 | ||
| 95 | #[cfg(all(feature = "async-client", feature = "blocking-client"))] | 92 | #[cfg(all(feature = "async-client", feature = "blocking-client"))] |
| @@ -99,7 +99,7 @@ pub use gix_object as objs; · 98 unmodified lines | |||
| 99 | pub use gix_object::bstr; | 99 | pub use gix_object::bstr; |
| 100 | pub use gix_odb as odb; | 100 | pub use gix_odb as odb; |
| 101 | pub use gix_prompt as prompt; | 101 | pub use gix_prompt as prompt; |
| 102 | #[cfg(all(feature = "gix-protocol"))] | 102 | #[cfg(feature = "gix-protocol")] |
| 103 | pub use gix_protocol as protocol; | 103 | pub use gix_protocol as protocol; |
| 104 | pub use gix_ref as refs; | 104 | pub use gix_ref as refs; |
| 105 | pub use gix_refspec as refspec; | 105 | pub use gix_refspec as refspec; |