Unified · Split
| @@ -82,7 +82,7 @@ mod ignore { · 81 unmodified lines | ||
| 82 | 82 | ); |
| 83 | 83 | } |
| 84 | 84 | (None, None) => {} |
| 85 | − (actual, expected) => panic!("actual {:?} should match {:?} with path '{}'", actual, expected, path), | |
| 85 | + (actual, expected) => panic!("actual {actual:?} should match {expected:?} with path '{path}'"), | |
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | Ok(()) |
| @@ -275,7 +275,7 @@ fn unspecified(attr: &str) -> (BString, StateRef) { · 274 unmodified lines | ||
| 275 | 275 | (attr.into(), StateRef::Unspecified) |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | −fn value<'a, 'b>(attr: &'a str, value: &'b str) -> (BString, StateRef<'b>) { | |
| 278 | +fn value<'b>(attr: &str, value: &'b str) -> (BString, StateRef<'b>) { | |
| 279 | 279 | (attr.into(), StateRef::Value(value.as_bytes().as_bstr())) |
| 280 | 280 | } |
| 281 | 281 | |
| @@ -148,7 +148,7 @@ impl TryFrom<&Path> for File { · 147 unmodified lines | ||
| 148 | 148 | if chunk_size % entry_size != 0 { |
| 149 | 149 | return Err(Error::InvalidChunkSize { |
| 150 | 150 | id: COMMIT_DATA_CHUNK_ID, |
| 151 | − msg: format!("chunk size {} is not a multiple of {}", chunk_size, entry_size), | |
| 151 | + msg: format!("chunk size {chunk_size} is not a multiple of {entry_size}"), | |
| 152 | 152 | }); |
| 153 | 153 | } |
| 154 | 154 | Ok(( |
| @@ -166,7 +166,7 @@ impl TryFrom<&Path> for File { · 11 unmodified lines | ||
| 166 | 166 | if chunk_size != expected_size { |
| 167 | 167 | return Err(Error::InvalidChunkSize { |
| 168 | 168 | id: OID_FAN_CHUNK_ID, |
| 169 | − msg: format!("expected chunk length {}, got {}", expected_size, chunk_size), | |
| 169 | + msg: format!("expected chunk length {expected_size}, got {chunk_size}"), | |
| 170 | 170 | }); |
| 171 | 171 | } |
| 172 | 172 | Ok(chunk_range.start) |
| @@ -62,7 +62,7 @@ impl Graph { · 61 unmodified lines | ||
| 62 | 62 | err: e, |
| 63 | 63 | path: chain_file_path.clone(), |
| 64 | 64 | })?; |
| 65 | − let graph_file_path = commit_graphs_dir.join(format!("graph-{}.graph", hash)); | |
| 65 | + let graph_file_path = commit_graphs_dir.join(format!("graph-{hash}.graph")); | |
| 66 | 66 | files.push(File::at(&graph_file_path).map_err(|e| Error::File { |
| 67 | 67 | err: e, |
| 68 | 68 | path: graph_file_path.clone(), |
| @@ -148,7 +148,7 @@ impl Display for Name { · 147 unmodified lines | ||
| 148 | 148 | Self::White => write!(f, "white"), |
| 149 | 149 | Self::BrightWhite => write!(f, "brightwhite"), |
| 150 | 150 | Self::Ansi(num) => num.fmt(f), |
| 151 | − Self::Rgb(r, g, b) => write!(f, "#{:02x}{:02x}{:02x}", r, g, b), | |
| 151 | + Self::Rgb(r, g, b) => write!(f, "#{r:02x}{g:02x}{b:02x}"), | |
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | } |
| @@ -26,7 +26,7 @@ impl Display for Integer { · 25 unmodified lines | ||
| 26 | 26 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
| 27 | 27 | write!(f, "{}", self.value)?; |
| 28 | 28 | if let Some(suffix) = self.suffix { |
| 29 | − write!(f, "{}", suffix) | |
| 29 | + write!(f, "{suffix}") | |
| 30 | 30 | } else { |
| 31 | 31 | Ok(()) |
| 32 | 32 | } |
| @@ -56,10 +56,10 @@ impl File<'static> { · 55 unmodified lines | ||
| 56 | 56 | let mut config = File::new(meta); |
| 57 | 57 | for i in 0..count { |
| 58 | 58 | let key = git_path::os_string_into_bstring( |
| 59 | − env::var_os(format!("GIT_CONFIG_KEY_{}", i)).ok_or(Error::InvalidKeyId { key_id: i })?, | |
| 59 | + env::var_os(format!("GIT_CONFIG_KEY_{i}")).ok_or(Error::InvalidKeyId { key_id: i })?, | |
| 60 | 60 | ) |
| 61 | 61 | .map_err(|_| Error::IllformedUtf8 { index: i, kind: "key" })?; |
| 62 | − let value = env::var_os(format!("GIT_CONFIG_VALUE_{}", i)).ok_or(Error::InvalidValueId { value_id: i })?; | |
| 62 | + let value = env::var_os(format!("GIT_CONFIG_VALUE_{i}")).ok_or(Error::InvalidValueId { value_id: i })?; | |
| 63 | 63 | let key = parse::key(<_ as AsRef<BStr>>::as_ref(&key)).ok_or_else(|| Error::InvalidKeyValue { |
| 64 | 64 | key_id: i, |
| 65 | 65 | key_val: key.to_string(), |
| @@ -217,9 +217,9 @@ impl<'a, 'event> SectionMut<'a, 'event> { · 216 unmodified lines | ||
| 217 | 217 | } |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | − pub(crate) fn get<'key>( | |
| 220 | + pub(crate) fn get( | |
| 221 | 221 | &self, |
| 222 | − key: &Key<'key>, | |
| 222 | + key: &Key<'_>, | |
| 223 | 223 | start: Index, |
| 224 | 224 | end: Index, |
| 225 | 225 | ) -> Result<Cow<'_, BStr>, lookup::existing::Error> { |
| @@ -67,7 +67,7 @@ pub(crate) fn ends_with_newline(e: &[crate::parse::Event<'_>], nl: impl AsRef<[u · 66 unmodified lines | ||
| 67 | 67 | .unwrap_or(false) |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | −pub(crate) fn extract_newline<'a, 'b>(e: &'a Event<'b>) -> Option<&'a BStr> { | |
| 70 | +pub(crate) fn extract_newline<'a>(e: &'a Event<'_>) -> Option<&'a BStr> { | |
| 71 | 71 | match e { |
| 72 | 72 | Event::Newline(b) => b.as_ref().into(), |
| 73 | 73 | _ => None, |
| @@ -55,7 +55,7 @@ impl Display for Error { · 54 unmodified lines | ||
| 55 | 55 | data_size - 10 |
| 56 | 56 | ) |
| 57 | 57 | } |
| 58 | − (Ok(data), _) => write!(f, "'{}'", data), | |
| 58 | + (Ok(data), _) => write!(f, "'{data}'"), | |
| 59 | 59 | (Err(_), _) => self.parsed_until.fmt(f), |
| 60 | 60 | } |
| 61 | 61 | } |
| @@ -62,7 +62,7 @@ mod mutate { · 61 unmodified lines | ||
| 62 | 62 | self.host = url.host().map(ToOwned::to_owned).map(|mut host| { |
| 63 | 63 | if let Some(port) = url.port { |
| 64 | 64 | use std::fmt::Write; |
| 65 | − write!(host, ":{}", port).expect("infallible"); | |
| 65 | + write!(host, ":{port}").expect("infallible"); | |
| 66 | 66 | } |
| 67 | 67 | host |
| 68 | 68 | }); |
| @@ -163,7 +163,7 @@ mod invoke { · 162 unmodified lines | ||
| 163 | 163 | fn fixtures<'a>(names: impl IntoIterator<Item = &'a str>) -> Vec<Program> { |
| 164 | 164 | names |
| 165 | 165 | .into_iter() |
| 166 | − .map(|name| git_path::realpath(fixture_path(format!("{}.sh", name))).unwrap()) | |
| 166 | + .map(|name| git_path::realpath(fixture_path(format!("{name}.sh"))).unwrap()) | |
| 167 | 167 | .map(|path| { |
| 168 | 168 | let mut script = git_path::to_unix_separators_on_windows(git_path::into_bstr(path)).into_owned(); |
| 169 | 169 | script.insert_str(0, "sh "); |
| @@ -95,21 +95,19 @@ username=bob"; · 94 unmodified lines | ||
| 95 | 95 | #[test] |
| 96 | 96 | fn quit_supports_git_config_boolean_values() { |
| 97 | 97 | for true_value in ["1", "42", "-42", "true", "on", "yes"] { |
| 98 | − let input = format!("quit={}", true_value); | |
| 98 | + let input = format!("quit={true_value}"); | |
| 99 | 99 | assert_eq!( |
| 100 | 100 | Context::from_bytes(input.as_bytes()).unwrap().quit, |
| 101 | 101 | Some(true), |
| 102 | − "{}", | |
| 103 | − input | |
| 102 | + "{input}" | |
| 104 | 103 | ) |
| 105 | 104 | } |
| 106 | 105 | for false_value in ["0", "false", "off", "no"] { |
| 107 | − let input = format!("quit={}", false_value); | |
| 106 | + let input = format!("quit={false_value}"); | |
| 108 | 107 | assert_eq!( |
| 109 | 108 | Context::from_bytes(input.as_bytes()).unwrap().quit, |
| 110 | 109 | Some(false), |
| 111 | − "{}", | |
| 112 | − input | |
| 110 | + "{input}" | |
| 113 | 111 | ) |
| 114 | 112 | } |
| 115 | 113 | } |
| @@ -126,7 +126,7 @@ mod program { · 125 unmodified lines | ||
| 126 | 126 | |
| 127 | 127 | pub fn script_helper(name: &str) -> Program { |
| 128 | 128 | let mut script = git_path::to_unix_separators_on_windows(git_path::into_bstr( |
| 129 | − git_path::realpath(fixture_path(format!("{}.sh", name))).unwrap(), | |
| 129 | + git_path::realpath(fixture_path(format!("{name}.sh"))).unwrap(), | |
| 130 | 130 | )) |
| 131 | 131 | .into_owned(); |
| 132 | 132 | script.insert_str(0, "sh "); |
| @@ -26,7 +26,7 @@ impl Time { · 25 unmodified lines | ||
| 26 | 26 | const SECONDS_PER_HOUR: i32 = 60 * 60; |
| 27 | 27 | let offset = self.offset_in_seconds.abs(); |
| 28 | 28 | let hours = offset / SECONDS_PER_HOUR; |
| 29 | − assert!(hours < 25, "offset is more than a day: {}", hours); | |
| 29 | + assert!(hours < 25, "offset is more than a day: {hours}"); | |
| 30 | 30 | let minutes = (offset - (hours * SECONDS_PER_HOUR)) / 60; |
| 31 | 31 | |
| 32 | 32 | if hours < 10 { |
| @@ -81,8 +81,7 @@ mod tests { · 80 unmodified lines | ||
| 81 | 81 | let actual = std::mem::size_of::<Change>(); |
| 82 | 82 | assert!( |
| 83 | 83 | actual <= 46, |
| 84 | − "{} <= 46: this type shouldn't grow without us knowing", | |
| 85 | − actual | |
| 84 | + "{actual} <= 46: this type shouldn't grow without us knowing" | |
| 86 | 85 | ) |
| 87 | 86 | } |
| 88 | 87 | } |
| @@ -25,7 +25,7 @@ mod changes { · 24 unmodified lines | ||
| 25 | 25 | ) -> crate::Result<TreeRefIter<'a>> { |
| 26 | 26 | let tree_id = db |
| 27 | 27 | .try_find(commit, buf)? |
| 28 | − .ok_or_else(|| format!("start commit {:?} to be present", commit))? | |
| 28 | + .ok_or_else(|| format!("start commit {commit:?} to be present"))? | |
| 29 | 29 | .0 |
| 30 | 30 | .decode()? |
| 31 | 31 | .into_commit() |
| @@ -66,7 +66,7 @@ mod changes { · 34 unmodified lines | ||
| 66 | 66 | let (main_tree_id, parent_commit_id) = { |
| 67 | 67 | let commit = db |
| 68 | 68 | .try_find(commit_id, &mut buf)? |
| 69 | − .ok_or_else(|| format!("start commit {:?} to be present", commit_id))? | |
| 69 | + .ok_or_else(|| format!("start commit {commit_id:?} to be present"))? | |
| 70 | 70 | .0 |
| 71 | 71 | .decode()? |
| 72 | 72 | .into_commit() |
| @@ -138,7 +138,7 @@ mod tests { · 137 unmodified lines | ||
| 138 | 138 | |
| 139 | 139 | // Parse & build ceiling dirs string |
| 140 | 140 | let symlink_str = symlink_path.to_str().expect("symlink path is valid utf8"); |
| 141 | − let ceiling_dir_string = format!("{}:relative::{}", symlink_str, symlink_str); | |
| 141 | + let ceiling_dir_string = format!("{symlink_str}:relative::{symlink_str}"); | |
| 142 | 142 | let ceiling_dirs = parse_ceiling_dirs(OsStr::new(ceiling_dir_string.as_str())); |
| 143 | 143 | |
| 144 | 144 | assert_eq!(ceiling_dirs.len(), 2, "Relative path is discarded"); |
| @@ -316,19 +316,13 @@ mod submodules { · 315 unmodified lines | ||
| 316 | 316 | let (path, _trust) = git_discover::upwards(&submodule_m1_workdir)?; |
| 317 | 317 | assert!( |
| 318 | 318 | matches!(path, git_discover::repository::Path::LinkedWorkTree{ref work_dir, ref git_dir} if work_dir == &submodule_m1_workdir && git_dir == &submodule_m1_gitdir), |
| 319 | − "{:?} should match {:?} {:?}", | |
| 320 | − path, | |
| 321 | − submodule_m1_workdir, | |
| 322 | − submodule_m1_gitdir | |
| 319 | + "{path:?} should match {submodule_m1_workdir:?} {submodule_m1_gitdir:?}" | |
| 323 | 320 | ); |
| 324 | 321 | |
| 325 | 322 | let (path, _trust) = git_discover::upwards(submodule_m1_workdir.join("subdir"))?; |
| 326 | 323 | assert!( |
| 327 | 324 | matches!(path, git_discover::repository::Path::LinkedWorkTree{ref work_dir, ref git_dir} if work_dir == &submodule_m1_workdir && git_dir == &submodule_m1_gitdir), |
| 328 | − "{:?} should match {:?} {:?}", | |
| 329 | − path, | |
| 330 | − submodule_m1_workdir, | |
| 331 | − submodule_m1_gitdir | |
| 325 | + "{path:?} should match {submodule_m1_workdir:?} {submodule_m1_gitdir:?}" | |
| 332 | 326 | ); |
| 333 | 327 | } |
| 334 | 328 | Ok(()) |
| @@ -343,9 +337,7 @@ mod submodules { · 8 unmodified lines | ||
| 343 | 337 | let (path, _trust) = git_discover::upwards(&submodule_m1_gitdir)?; |
| 344 | 338 | assert!( |
| 345 | 339 | matches!(path, git_discover::repository::Path::Repository(ref dir) if dir == &submodule_m1_gitdir), |
| 346 | − "{:?} should match {:?}", | |
| 347 | − path, | |
| 348 | − submodule_m1_gitdir | |
| 340 | + "{path:?} should match {submodule_m1_gitdir:?}" | |
| 349 | 341 | ); |
| 350 | 342 | } |
| 351 | 343 | Ok(()) |
| @@ -61,11 +61,10 @@ fn compare_baseline_with_ours() { · 60 unmodified lines | ||
| 61 | 61 | } in Baseline::new(&input) |
| 62 | 62 | { |
| 63 | 63 | total_matches += 1; |
| 64 | − assert!(seen.insert(m), "duplicate match entry: {:?}", m); | |
| 64 | + assert!(seen.insert(m), "duplicate match entry: {m:?}"); | |
| 65 | 65 | assert_eq!( |
| 66 | 66 | is_match, *expected_matches, |
| 67 | − "baseline for matches must be {} - check baseline and git version: {:?}", | |
| 68 | − expected_matches, m | |
| 67 | + "baseline for matches must be {expected_matches} - check baseline and git version: {m:?}" | |
| 69 | 68 | ); |
| 70 | 69 | match std::panic::catch_unwind(|| { |
| 71 | 70 | let pattern = pat(pattern); |
| @@ -157,7 +157,7 @@ impl std::fmt::Debug for ObjectId { · 156 unmodified lines | ||
| 157 | 157 | ObjectId::Sha1(_hash) => f.write_str("Sha1(")?, |
| 158 | 158 | } |
| 159 | 159 | for b in self.as_bytes() { |
| 160 | − write!(f, "{:02x}", b)?; | |
| 160 | + write!(f, "{b:02x}")?; | |
| 161 | 161 | } |
| 162 | 162 | f.write_str(")") |
| 163 | 163 | } |
| @@ -173,7 +173,7 @@ impl From<&[u8]> for ObjectId { · 9 unmodified lines | ||
| 173 | 173 | fn from(v: &[u8]) -> Self { |
| 174 | 174 | match v.len() { |
| 175 | 175 | 20 => Self::Sha1(v.try_into().expect("prior length validation")), |
| 176 | − other => panic!("BUG: unsupported hash len: {}", other), | |
| 176 | + other => panic!("BUG: unsupported hash len: {other}"), | |
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | } |
| @@ -180,7 +180,7 @@ impl<'a> From<&'a [u8; SIZE_OF_SHA1_DIGEST]> for &'a oid { · 179 unmodified lines | ||
| 180 | 180 | impl fmt::Display for &oid { |
| 181 | 181 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 182 | 182 | for b in self.as_bytes() { |
| 183 | − write!(f, "{:02x}", b)?; | |
| 183 | + write!(f, "{b:02x}")?; | |
| 184 | 184 | } |
| 185 | 185 | Ok(()) |
| 186 | 186 | } |
| @@ -47,7 +47,7 @@ mod new { · 46 unmodified lines | ||
| 47 | 47 | let num_of_zeros = oid.kind().len_in_hex() - hex_len; |
| 48 | 48 | expected.extend(std::iter::repeat('0').take(num_of_zeros)); |
| 49 | 49 | let prefix = git_hash::Prefix::new(oid, hex_len).unwrap(); |
| 50 | − assert_eq!(prefix.as_oid().to_hex().to_string(), expected, "{}", hex_len); | |
| 50 | + assert_eq!(prefix.as_oid().to_hex().to_string(), expected, "{hex_len}"); | |
| 51 | 51 | assert_eq!(prefix.hex_len(), hex_len); |
| 52 | 52 | assert_eq!(prefix.cmp_oid(&oid), Ordering::Equal); |
| 53 | 53 | } |
| @@ -102,21 +102,16 @@ mod tests { · 101 unmodified lines | ||
| 102 | 102 | } |
| 103 | 103 | assert!( |
| 104 | 104 | actual * 1000 >= (expected - 1) * 750, |
| 105 | − "value too small: {} < {}", | |
| 106 | − actual, | |
| 107 | − expected | |
| 105 | + "value too small: {actual} < {expected}" | |
| 108 | 106 | ); |
| 109 | 107 | assert!( |
| 110 | 108 | actual * 1000 <= (expected + 1) * 1250, |
| 111 | − "value too big: {} > {}", | |
| 112 | − actual, | |
| 113 | − expected | |
| 109 | + "value too big: {actual} > {expected}" | |
| 114 | 110 | ); |
| 115 | 111 | } |
| 116 | 112 | assert!( |
| 117 | 113 | num_identities < EXPECTED_TILL_SECOND.len(), |
| 118 | − "too many untransformed values: {}", | |
| 119 | − num_identities | |
| 114 | + "too many untransformed values: {num_identities}" | |
| 120 | 115 | ); |
| 121 | 116 | } |
| 122 | 117 | |
| @@ -33,8 +33,7 @@ fn size_in_memory() { · 32 unmodified lines | ||
| 33 | 33 | let actual = std::mem::size_of::<git_object::Object>(); |
| 34 | 34 | assert!( |
| 35 | 35 | actual <= 264, |
| 36 | − "{} <= 264: Prevent unexpected growth of what should be lightweight objects", | |
| 37 | − actual | |
| 36 | + "{actual} <= 264: Prevent unexpected growth of what should be lightweight objects" | |
| 38 | 37 | ) |
| 39 | 38 | } |
| 40 | 39 | |
| @@ -70,7 +70,7 @@ pub(crate) mod error { · 69 unmodified lines | ||
| 70 | 70 | #[test] |
| 71 | 71 | fn error_size() { |
| 72 | 72 | let actual = std::mem::size_of::<Error>(); |
| 73 | − assert!(actual <= 88, "{} <= 88: should not grow without us noticing", actual); | |
| 73 | + assert!(actual <= 88, "{actual} <= 88: should not grow without us noticing"); | |
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | } |
| @@ -219,7 +219,7 @@ where · 142 unmodified lines | ||
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | out.unwrap_or_else(|| { |
| 222 | − panic!("could not find object {} in any index after looking up one of its base objects {}", id, base_id) | |
| 222 | + panic!("could not find object {id} in any index after looking up one of its base objects {base_id}" ) | |
| 223 | 223 | }) |
| 224 | 224 | } |
| 225 | 225 | }; |
| @@ -119,7 +119,7 @@ where · 118 unmodified lines | ||
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | out.unwrap_or_else(|| { |
| 122 | − panic!("could not find object {} in any index after looking up one of its base objects {}", id, base_id) | |
| 122 | + panic!("could not find object {id} in any index after looking up one of its base objects {base_id}") | |
| 123 | 123 | }) |
| 124 | 124 | } |
| 125 | 125 | }; |
| @@ -143,7 +143,7 @@ where · 142 unmodified lines | ||
| 143 | 143 | ( |
| 144 | 144 | Vec::<u8>::with_capacity(4096), |
| 145 | 145 | lock(&object_progress) |
| 146 | − .add_child_with_id(format!("thread {}", thread_index), git_features::progress::UNKNOWN), | |
| 146 | + .add_child_with_id(format!("thread {thread_index}"), git_features::progress::UNKNOWN), | |
| 147 | 147 | new_thread_state(), |
| 148 | 148 | resolve.clone(), |
| 149 | 149 | inspect_object.clone(), |
| @@ -40,7 +40,7 @@ mod memory { · 39 unmodified lines | ||
| 40 | 40 | .with_scale(CustomScale), |
| 41 | 41 | ), |
| 42 | 42 | free_list: Vec::new(), |
| 43 | − debug: git_features::cache::Debug::new(format!("MemoryCappedHashmap({}B)", memory_cap_in_bytes)), | |
| 43 | + debug: git_features::cache::Debug::new(format!("MemoryCappedHashmap({memory_cap_in_bytes}B)")), | |
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | } |
| @@ -113,7 +113,7 @@ mod _static { · 66 unmodified lines | ||
| 113 | 113 | StaticLinkedList { |
| 114 | 114 | inner: Default::default(), |
| 115 | 115 | free_list: Vec::new(), |
| 116 | − debug: git_features::cache::Debug::new(format!("StaticLinkedList<{}>", SIZE)), | |
| 116 | + debug: git_features::cache::Debug::new(format!("StaticLinkedList<{SIZE}>")), | |
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | } |
| @@ -49,7 +49,7 @@ mod memory { · 48 unmodified lines | ||
| 49 | 49 | .with_scale(CustomScale), |
| 50 | 50 | ), |
| 51 | 51 | free_list: Vec::new(), |
| 52 | − debug: git_features::cache::Debug::new(format!("MemoryCappedObjectHashmap({}B)", memory_cap_in_bytes)), | |
| 52 | + debug: git_features::cache::Debug::new(format!("MemoryCappedObjectHashmap({memory_cap_in_bytes}B)")), | |
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | } |
| @@ -23,8 +23,7 @@ impl data::File { · 22 unmodified lines | ||
| 23 | 23 | let pack_len = data.len(); |
| 24 | 24 | if pack_len < N32_SIZE * 3 + hash_len { |
| 25 | 25 | return Err(data::header::decode::Error::Corrupt(format!( |
| 26 | − "Pack data of size {} is too small for even an empty pack with shortest hash", | |
| 27 | − pack_len | |
| 26 | + "Pack data of size {pack_len} is too small for even an empty pack with shortest hash" | |
| 28 | 27 | ))); |
| 29 | 28 | } |
| 30 | 29 | let (kind, num_objects) = |
| @@ -90,11 +90,11 @@ where · 89 unmodified lines | ||
| 90 | 90 | } else { |
| 91 | 91 | header_bytes.len() as u64 |
| 92 | 92 | }; |
| 93 | − self.output.seek(std::io::SeekFrom::Start(0))?; | |
| 93 | + self.output.rewind()?; | |
| 94 | 94 | self.output.write_all(&header_bytes[..])?; |
| 95 | 95 | self.output.flush()?; |
| 96 | 96 | |
| 97 | − self.output.seek(std::io::SeekFrom::Start(0))?; | |
| 97 | + self.output.rewind()?; | |
| 98 | 98 | let interrupt_never = std::sync::atomic::AtomicBool::new(false); |
| 99 | 99 | let digest = hash::bytes( |
| 100 | 100 | &mut self.output, |
| @@ -79,7 +79,7 @@ where · 78 unmodified lines | ||
| 79 | 79 | { |
| 80 | 80 | let mut p = progress |
| 81 | 81 | .lock() |
| 82 | − .add_child_with_id(format!("thread {}", n), git_features::progress::UNKNOWN); | |
| 82 | + .add_child_with_id(format!("thread {n}"), git_features::progress::UNKNOWN); | |
| 83 | 83 | p.init(None, git_features::progress::count("objects")); |
| 84 | 84 | p |
| 85 | 85 | }, |
| @@ -143,7 +143,7 @@ pub(crate) mod function { · 142 unmodified lines | ||
| 143 | 143 | Vec::new(), // object data buffer |
| 144 | 144 | progress |
| 145 | 145 | .lock() |
| 146 | − .add_child_with_id(format!("thread {}", n), git_features::progress::UNKNOWN), | |
| 146 | + .add_child_with_id(format!("thread {n}"), git_features::progress::UNKNOWN), | |
| 147 | 147 | ) |
| 148 | 148 | } |
| 149 | 149 | }, |
| @@ -40,7 +40,7 @@ impl index::File { · 39 unmodified lines | ||
| 40 | 40 | let footer_size = hash_len * 2; |
| 41 | 41 | if idx_len < FAN_LEN * N32_SIZE + footer_size { |
| 42 | 42 | return Err(Error::Corrupt { |
| 43 | − message: format!("Pack index of size {} is too small for even an empty index", idx_len), | |
| 43 | + message: format!("Pack index of size {idx_len} is too small for even an empty index"), | |
| 44 | 44 | }); |
| 45 | 45 | } |
| 46 | 46 | let (kind, fan, num_objects) = { |
| @@ -76,7 +76,7 @@ where · 75 unmodified lines | ||
| 76 | 76 | fn feed(&mut self, input: Self::Input) -> Result<(), Self::Error> { |
| 77 | 77 | let chunk_stats: Vec<_> = match input { |
| 78 | 78 | Err(err @ traverse::Error::PackDecode { .. }) if !self.check.fatal_decode_error() => { |
| 79 | − lock(&self.progress).info(format!("Ignoring decode error: {}", err)); | |
| 79 | + lock(&self.progress).info(format!("Ignoring decode error: {err}")); | |
| 80 | 80 | return Ok(()); |
| 81 | 81 | } |
| 82 | 82 | res => res, |
| @@ -150,7 +150,7 @@ impl index::File { · 149 unmodified lines | ||
| 150 | 150 | ); |
| 151 | 151 | match result { |
| 152 | 152 | Err(err @ Error::PackDecode { .. }) if !check.fatal_decode_error() => { |
| 153 | − progress.info(format!("Ignoring decode error: {}", err)); | |
| 153 | + progress.info(format!("Ignoring decode error: {err}")); | |
| 154 | 154 | Ok(()) |
| 155 | 155 | } |
| 156 | 156 | res => res, |
| @@ -136,7 +136,7 @@ impl index::File { · 135 unmodified lines | ||
| 136 | 136 | new_processor(), |
| 137 | 137 | Vec::with_capacity(2048), // decode buffer |
| 138 | 138 | lock(&reduce_progress) |
| 139 | − .add_child_with_id(format!("thread {}", index), git_features::progress::UNKNOWN), // per thread progress | |
| 139 | + .add_child_with_id(format!("thread {index}"), git_features::progress::UNKNOWN), // per thread progress | |
| 140 | 140 | ) |
| 141 | 141 | } |
| 142 | 142 | }; |
| @@ -171,7 +171,7 @@ impl index::File { · 28 unmodified lines | ||
| 171 | 171 | progress.inc(); |
| 172 | 172 | let stat = match result { |
| 173 | 173 | Err(err @ Error::PackDecode { .. }) if !check.fatal_decode_error() => { |
| 174 | − progress.info(format!("Ignoring decode error: {}", err)); | |
| 174 | + progress.info(format!("Ignoring decode error: {err}")); | |
| 175 | 175 | continue; |
| 176 | 176 | } |
| 177 | 177 | res => res, |
| @@ -170,8 +170,7 @@ impl crate::index::File { · 169 unmodified lines | ||
| 170 | 170 | } |
| 171 | 171 | if num_objects != anticipated_num_objects { |
| 172 | 172 | objects_progress.info(format!( |
| 173 | − "{} objects were resolved into {} objects during thin-pack resolution", | |
| 174 | − anticipated_num_objects, num_objects | |
| 173 | + "{anticipated_num_objects} objects were resolved into {num_objects} objects during thin-pack resolution" | |
| 175 | 174 | )); |
| 176 | 175 | } |
| 177 | 176 | let num_objects: u32 = num_objects |
| @@ -127,8 +127,7 @@ fn trailing_relative_components_are_resolved() { · 126 unmodified lines | ||
| 127 | 127 | assert_eq!( |
| 128 | 128 | normalize(path, cwd).unwrap_or_else(|| panic!("{path:?}")), |
| 129 | 129 | Cow::Borrowed(p(expected)), |
| 130 | − "'{}' got an unexpected result", | |
| 131 | − input | |
| 130 | + "'{input}' got an unexpected result" | |
| 132 | 131 | ); |
| 133 | 132 | } |
| 134 | 133 | } |
| @@ -266,11 +266,7 @@ mod parse { · 265 unmodified lines | ||
| 266 | 266 | fn empty_input() { |
| 267 | 267 | let input = ""; |
| 268 | 268 | |
| 269 | − assert!( | |
| 270 | − !check_against_baseline(input), | |
| 271 | − "This pathspec is valid in git: {}", | |
| 272 | − input | |
| 273 | − ); | |
| 269 | + assert!(!check_against_baseline(input), "This pathspec is valid in git: {input}"); | |
| 274 | 270 | |
| 275 | 271 | let output = git_pathspec::parse(input.as_bytes()); |
| 276 | 272 | assert!(output.is_err()); |
| @@ -285,11 +281,7 @@ mod parse { · 8 unmodified lines | ||
| 285 | 281 | ]; |
| 286 | 282 | |
| 287 | 283 | for input in inputs.into_iter() { |
| 288 | − assert!( | |
| 289 | − !check_against_baseline(input), | |
| 290 | − "This pathspec is valid in git: {}", | |
| 291 | − input | |
| 292 | − ); | |
| 284 | + assert!(!check_against_baseline(input), "This pathspec is valid in git: {input}"); | |
| 293 | 285 | |
| 294 | 286 | let output = git_pathspec::parse(input.as_bytes()); |
| 295 | 287 | assert!(output.is_err()); |
| @@ -307,11 +299,7 @@ mod parse { · 11 unmodified lines | ||
| 307 | 299 | ]; |
| 308 | 300 | |
| 309 | 301 | for input in inputs.into_iter() { |
| 310 | − assert!( | |
| 311 | − !check_against_baseline(input), | |
| 312 | − "This pathspec is valid in git: {}", | |
| 313 | − input | |
| 314 | − ); | |
| 302 | + assert!(!check_against_baseline(input), "This pathspec is valid in git: {input}"); | |
| 315 | 303 | |
| 316 | 304 | let output = git_pathspec::parse(input.as_bytes()); |
| 317 | 305 | assert!(output.is_err()); |
| @@ -329,14 +317,10 @@ mod parse { · 11 unmodified lines | ||
| 329 | 317 | ]; |
| 330 | 318 | |
| 331 | 319 | for input in inputs { |
| 332 | − assert!( | |
| 333 | − !check_against_baseline(input), | |
| 334 | − "This pathspec is valid in git: {}", | |
| 335 | − input | |
| 336 | − ); | |
| 320 | + assert!(!check_against_baseline(input), "This pathspec is valid in git: {input}"); | |
| 337 | 321 | |
| 338 | 322 | let output = git_pathspec::parse(input.as_bytes()); |
| 339 | − assert!(output.is_err(), "This pathspec did not produce an error {}", input); | |
| 323 | + assert!(output.is_err(), "This pathspec did not produce an error {input}"); | |
| 340 | 324 | assert!(matches!(output.unwrap_err(), Error::InvalidAttribute { .. })); |
| 341 | 325 | } |
| 342 | 326 | } |
| @@ -355,18 +339,13 @@ mod parse { · 12 unmodified lines | ||
| 355 | 339 | ]; |
| 356 | 340 | |
| 357 | 341 | for input in inputs { |
| 358 | − assert!( | |
| 359 | − !check_against_baseline(input), | |
| 360 | − "This pathspec is valid in git: {}", | |
| 361 | − input | |
| 362 | − ); | |
| 342 | + assert!(!check_against_baseline(input), "This pathspec is valid in git: {input}"); | |
| 363 | 343 | |
| 364 | 344 | let output = git_pathspec::parse(input.as_bytes()); |
| 365 | − assert!(output.is_err(), "This pathspec did not produce an error {}", input); | |
| 345 | + assert!(output.is_err(), "This pathspec did not produce an error {input}"); | |
| 366 | 346 | assert!( |
| 367 | 347 | matches!(output.unwrap_err(), Error::InvalidAttributeValue { .. }), |
| 368 | − "Errors did not match for pathspec: {}", | |
| 369 | − input | |
| 348 | + "Errors did not match for pathspec: {input}" | |
| 370 | 349 | ); |
| 371 | 350 | } |
| 372 | 351 | } |
| @@ -380,14 +359,10 @@ mod parse { · 7 unmodified lines | ||
| 380 | 359 | ]; |
| 381 | 360 | |
| 382 | 361 | for input in inputs { |
| 383 | − assert!( | |
| 384 | − !check_against_baseline(input), | |
| 385 | − "This pathspec is valid in git: {}", | |
| 386 | − input | |
| 387 | − ); | |
| 362 | + assert!(!check_against_baseline(input), "This pathspec is valid in git: {input}"); | |
| 388 | 363 | |
| 389 | 364 | let output = git_pathspec::parse(input.as_bytes()); |
| 390 | − assert!(output.is_err(), "This pathspec did not produce an error {}", input); | |
| 365 | + assert!(output.is_err(), "This pathspec did not produce an error {input}"); | |
| 391 | 366 | assert!(matches!(output.unwrap_err(), Error::TrailingEscapeCharacter)); |
| 392 | 367 | } |
| 393 | 368 | } |
| @@ -396,11 +371,7 @@ mod parse { · 2 unmodified lines | ||
| 396 | 371 | fn empty_attribute_specification() { |
| 397 | 372 | let input = ":(attr:)"; |
| 398 | 373 | |
| 399 | − assert!( | |
| 400 | − !check_against_baseline(input), | |
| 401 | − "This pathspec is valid in git: {}", | |
| 402 | − input | |
| 403 | − ); | |
| 374 | + assert!(!check_against_baseline(input), "This pathspec is valid in git: {input}"); | |
| 404 | 375 | |
| 405 | 376 | let output = git_pathspec::parse(input.as_bytes()); |
| 406 | 377 | assert!(output.is_err()); |
| @@ -411,11 +382,7 @@ mod parse { · 4 unmodified lines | ||
| 411 | 382 | fn multiple_attribute_specifications() { |
| 412 | 383 | let input = ":(attr:one,attr:two)some/path"; |
| 413 | 384 | |
| 414 | − assert!( | |
| 415 | − !check_against_baseline(input), | |
| 416 | − "This pathspec is valid in git: {}", | |
| 417 | − input | |
| 418 | − ); | |
| 385 | + assert!(!check_against_baseline(input), "This pathspec is valid in git: {input}"); | |
| 419 | 386 | |
| 420 | 387 | let output = git_pathspec::parse(input.as_bytes()); |
| 421 | 388 | assert!(output.is_err()); |
| @@ -426,11 +393,7 @@ mod parse { · 4 unmodified lines | ||
| 426 | 393 | fn missing_parentheses() { |
| 427 | 394 | let input = ":(top"; |
| 428 | 395 | |
| 429 | − assert!( | |
| 430 | − !check_against_baseline(input), | |
| 431 | − "This pathspec is valid in git: {}", | |
| 432 | − input | |
| 433 | − ); | |
| 396 | + assert!(!check_against_baseline(input), "This pathspec is valid in git: {input}"); | |
| 434 | 397 | |
| 435 | 398 | let output = git_pathspec::parse(input.as_bytes()); |
| 436 | 399 | assert!(output.is_err()); |
| @@ -441,11 +404,7 @@ mod parse { · 4 unmodified lines | ||
| 441 | 404 | fn glob_and_literal_keywords_present() { |
| 442 | 405 | let input = ":(glob,literal)some/path"; |
| 443 | 406 | |
| 444 | − assert!( | |
| 445 | − !check_against_baseline(input), | |
| 446 | − "This pathspec is valid in git: {}", | |
| 447 | − input | |
| 448 | − ); | |
| 407 | + assert!(!check_against_baseline(input), "This pathspec is valid in git: {input}"); | |
| 449 | 408 | |
| 450 | 409 | let output = git_pathspec::parse(input.as_bytes()); |
| 451 | 410 | assert!(output.is_err()); |
| @@ -457,14 +416,13 @@ mod parse { · 5 unmodified lines | ||
| 457 | 416 | for (input, expected) in inputs.into_iter() { |
| 458 | 417 | assert!( |
| 459 | 418 | check_against_baseline(input), |
| 460 | − "This pathspec is invalid in git: {}", | |
| 461 | − input | |
| 419 | + "This pathspec is invalid in git: {input}" | |
| 462 | 420 | ); |
| 463 | 421 | |
| 464 | 422 | let pattern: PatternForTesting = git_pathspec::parse(input.as_bytes()) |
| 465 | − .unwrap_or_else(|_| panic!("parsing should not fail with pathspec {}", input)) | |
| 423 | + .unwrap_or_else(|_| panic!("parsing should not fail with pathspec {input}")) | |
| 466 | 424 | .into(); |
| 467 | − assert_eq!(pattern, expected, "while checking input: \"{}\"", input); | |
| 425 | + assert_eq!(pattern, expected, "while checking input: \"{input}\""); | |
| 468 | 426 | } |
| 469 | 427 | } |
| 470 | 428 | |
| @@ -509,7 +467,7 @@ mod parse { · 38 unmodified lines | ||
| 509 | 467 | let key: &BStr = pathspec.into(); |
| 510 | 468 | let base = BASELINE |
| 511 | 469 | .get(key) |
| 512 | − .unwrap_or_else(|| panic!("missing baseline for pathspec: {:?}", pathspec)); | |
| 470 | + .unwrap_or_else(|| panic!("missing baseline for pathspec: {pathspec:?}")); | |
| 513 | 471 | *base == 0 |
| 514 | 472 | } |
| 515 | 473 | } |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | mod v1 { |
| 2 | 2 | fn capabilities(input: &str) -> git_transport::client::Capabilities { |
| 3 | − git_transport::client::Capabilities::from_bytes(format!("\0{}", input).as_bytes()) | |
| 3 | + git_transport::client::Capabilities::from_bytes(format!("\0{input}").as_bytes()) | |
| 4 | 4 | .expect("valid input capabilities") |
| 5 | 5 | .0 |
| 6 | 6 | } |
| @@ -54,7 +54,7 @@ mod v2 { · 47 unmodified lines | ||
| 54 | 54 | use git_transport::client::Capabilities; |
| 55 | 55 | |
| 56 | 56 | fn capabilities(command: &str, input: &str) -> Capabilities { |
| 57 | − Capabilities::from_lines(format!("version 2\n{}={}", command, input).into()) | |
| 57 | + Capabilities::from_lines(format!("version 2\n{command}={input}").into()) | |
| 58 | 58 | .expect("valid input for V2 capabilities") |
| 59 | 59 | } |
| 60 | 60 | |
| @@ -157,7 +157,7 @@ impl Arguments { · 156 unmodified lines | ||
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | fn prefixed(&mut self, prefix: &str, value: impl fmt::Display) { |
| 160 | − self.args.push(format!("{}{}", prefix, value).into()); | |
| 160 | + self.args.push(format!("{prefix}{value}").into()); | |
| 161 | 161 | } |
| 162 | 162 | /// Create a new instance to help setting up arguments to send to the server as part of a `fetch` operation |
| 163 | 163 | /// for which `features` are the available and configured features to use. |
| @@ -181,7 +181,7 @@ impl Arguments { · 17 unmodified lines | ||
| 181 | 181 | let baked_features = features |
| 182 | 182 | .iter() |
| 183 | 183 | .map(|(n, v)| match v { |
| 184 | − Some(v) => format!("{}={}", n, v), | |
| 184 | + Some(v) => format!("{n}={v}"), | |
| 185 | 185 | None => n.to_string(), |
| 186 | 186 | }) |
| 187 | 187 | .collect::<Vec<_>>(); |
| @@ -123,7 +123,7 @@ where · 122 unmodified lines | ||
| 123 | 123 | let mut round = 1; |
| 124 | 124 | 'negotiation: loop { |
| 125 | 125 | progress.step(); |
| 126 | − progress.set_name(format!("negotiate (round {})", round)); | |
| 126 | + progress.set_name(format!("negotiate (round {round})")); | |
| 127 | 127 | round += 1; |
| 128 | 128 | let action = delegate.negotiate(&refs, &mut arguments, previous_response.as_ref())?; |
| 129 | 129 | let mut reader = arguments.send(&mut transport, action == Action::Cancel).await?; |
| @@ -214,7 +214,7 @@ mod v2 { · 213 unmodified lines | ||
| 214 | 214 | fetch::response::Error::UploadPack(err) => { |
| 215 | 215 | assert_eq!(err.message, "segmentation fault\n") |
| 216 | 216 | } |
| 217 | − err => panic!("we expect upload pack errors, got {:#?}", err), | |
| 217 | + err => panic!("we expect upload pack errors, got {err:#?}"), | |
| 218 | 218 | }, |
| 219 | 219 | } |
| 220 | 220 | } |
| @@ -28,7 +28,7 @@ async fn clone() -> crate::Result { · 27 unmodified lines | ||
| 28 | 28 | "agent", |
| 29 | 29 | ) |
| 30 | 30 | .await?; |
| 31 | − assert_eq!(dlg.pack_bytes, 876, "{}: It be able to read pack bytes", fixture); | |
| 31 | + assert_eq!(dlg.pack_bytes, 876, "{fixture}: It be able to read pack bytes"); | |
| 32 | 32 | } |
| 33 | 33 | Ok(()) |
| 34 | 34 | } |
| @@ -140,7 +140,7 @@ async fn ls_remote_abort_in_prep_ls_refs() -> crate::Result { · 139 unmodified lines | ||
| 140 | 140 | assert_eq!(err.kind(), std::io::ErrorKind::Other); |
| 141 | 141 | assert_eq!(err.get_ref().expect("other error").to_string(), "hello world"); |
| 142 | 142 | } |
| 143 | − err => panic!("should not have another error here, got: {}", err), | |
| 143 | + err => panic!("should not have another error here, got: {err}"), | |
| 144 | 144 | } |
| 145 | 145 | Ok(()) |
| 146 | 146 | } |
| @@ -156,7 +156,7 @@ pub mod create_or_update { · 155 unmodified lines | ||
| 156 | 156 | .and_then(|_| committer.write_to(&mut file)) |
| 157 | 157 | .and_then(|_| { |
| 158 | 158 | if !message.is_empty() { |
| 159 | − writeln!(file, "\t{}", message) | |
| 159 | + writeln!(file, "\t{message}") | |
| 160 | 160 | } else { |
| 161 | 161 | writeln!(file) |
| 162 | 162 | } |
| @@ -183,7 +183,7 @@ impl<'s, 'p> Transaction<'s, 'p> { · 182 unmodified lines | ||
| 183 | 183 | let mut lock = lock.take().map(Ok).unwrap_or_else(obtain_lock)?; |
| 184 | 184 | |
| 185 | 185 | lock.with_mut(|file| match new { |
| 186 | − Target::Peeled(oid) => write!(file, "{}", oid), | |
| 186 | + Target::Peeled(oid) => write!(file, "{oid}"), | |
| 187 | 187 | Target::Symbolic(name) => write!(file, "ref: {}", name.0), |
| 188 | 188 | })?; |
| 189 | 189 | Some(lock.close()?) |
| @@ -81,7 +81,7 @@ impl packed::Transaction { · 80 unmodified lines | ||
| 81 | 81 | Some(kind) if kind == git_object::Kind::Tag => { |
| 82 | 82 | next_id = git_object::TagRefIter::from_bytes(&buf).target_id().map_err(|_| { |
| 83 | 83 | prepare::Error::Resolve( |
| 84 | − format!("Couldn't get target object id from tag {}", next_id).into(), | |
| 84 | + format!("Couldn't get target object id from tag {next_id}").into(), | |
| 85 | 85 | ) |
| 86 | 86 | })?; |
| 87 | 87 | } |
| @@ -90,7 +90,7 @@ impl packed::Transaction { · 2 unmodified lines | ||
| 90 | 90 | } |
| 91 | 91 | None => { |
| 92 | 92 | return Err(prepare::Error::Resolve( |
| 93 | − format!("Couldn't find object with id {}", next_id).into(), | |
| 93 | + format!("Couldn't find object with id {next_id}").into(), | |
| 94 | 94 | )) |
| 95 | 95 | } |
| 96 | 96 | } |
| @@ -194,7 +194,7 @@ fn write_packed_ref(mut out: impl std::io::Write, pref: packed::Reference<'_>) - · 97 unmodified lines | ||
| 194 | 194 | out.write_all(pref.name.as_bstr())?; |
| 195 | 195 | out.write_all(b"\n")?; |
| 196 | 196 | if let Some(object) = pref.object { |
| 197 | − writeln!(out, "^{}", object)?; | |
| 197 | + writeln!(out, "^{object}")?; | |
| 198 | 198 | } |
| 199 | 199 | Ok(()) |
| 200 | 200 | } |
| @@ -206,11 +206,11 @@ fn write_edit(mut out: impl std::io::Write, edit: &Edit, lines_written: &mut i32 · 5 unmodified lines | ||
| 206 | 206 | new: Target::Peeled(target_oid), |
| 207 | 207 | .. |
| 208 | 208 | } => { |
| 209 | − write!(out, "{} ", target_oid)?; | |
| 209 | + write!(out, "{target_oid} ")?; | |
| 210 | 210 | out.write_all(edit.inner.name.as_bstr())?; |
| 211 | 211 | out.write_all(b"\n")?; |
| 212 | 212 | if let Some(object) = edit.peeled { |
| 213 | − writeln!(out, "^{}", object)?; | |
| 213 | + writeln!(out, "^{object}")?; | |
| 214 | 214 | } |
| 215 | 215 | *lines_written += 1; |
| 216 | 216 | } |
| @@ -34,7 +34,7 @@ where · 33 unmodified lines | ||
| 34 | 34 | self.assure_one_name_has_one_edit().map_err(|name| { |
| 35 | 35 | std::io::Error::new( |
| 36 | 36 | std::io::ErrorKind::AlreadyExists, |
| 37 | − format!("A reference named '{}' has multiple edits", name), | |
| 37 | + format!("A reference named '{name}' has multiple edits"), | |
| 38 | 38 | ) |
| 39 | 39 | }) |
| 40 | 40 | } |
| @@ -121,10 +121,7 @@ where · 80 unmodified lines | ||
| 121 | 121 | if round == 5 { |
| 122 | 122 | break Err(std::io::Error::new( |
| 123 | 123 | std::io::ErrorKind::WouldBlock, |
| 124 | − format!( | |
| 125 | − "Could not follow all splits after {} rounds, assuming reference cycle", | |
| 126 | − round | |
| 127 | − ), | |
| 124 | + format!("Could not follow all splits after {round} rounds, assuming reference cycle"), | |
| 128 | 125 | )); |
| 129 | 126 | } |
| 130 | 127 | round += 1; |
| @@ -109,7 +109,7 @@ mod loose { · 108 unmodified lines | ||
| 109 | 109 | Err(git_ref::file::find::existing::Error::NotFound { name }) => { |
| 110 | 110 | assert_eq!(name, Path::new(*partial_name)); |
| 111 | 111 | } |
| 112 | − Err(err) => panic!("Unexpected err: {:?}", err), | |
| 112 | + Err(err) => panic!("Unexpected err: {err:?}"), | |
| 113 | 113 | }, |
| 114 | 114 | } |
| 115 | 115 | } |
| @@ -302,7 +302,7 @@ fn loose_iter_with_broken_refs() -> crate::Result { · 301 unmodified lines | ||
| 302 | 302 | "tags/t1" |
| 303 | 303 | ] |
| 304 | 304 | .into_iter() |
| 305 | − .map(|p| format!("refs/{}", p)) | |
| 305 | + .map(|p| format!("refs/{p}")) | |
| 306 | 306 | .collect::<Vec<_>>(), |
| 307 | 307 | "all paths are as expected" |
| 308 | 308 | ); |
| @@ -30,10 +30,7 @@ fn conflicting_creation_without_packed_refs() -> crate::Result { · 29 unmodified lines | ||
| 30 | 30 | match res { |
| 31 | 31 | Ok(_) if case_sensitive => {} |
| 32 | 32 | Ok(_) if !case_sensitive => panic!("should fail as 'a' and 'A' clash"), |
| 33 | − Err(err) if case_sensitive => panic!( | |
| 34 | − "should work as case sensitivity allows 'a' and 'A' to coexist: {:?}", | |
| 35 | − err | |
| 36 | − ), | |
| 33 | + Err(err) if case_sensitive => panic!("should work as case sensitivity allows 'a' and 'A' to coexist: {err:?}"), | |
| 37 | 34 | Err(err) if !case_sensitive => { |
| 38 | 35 | assert_eq!(err.to_string(), "A lock could not be obtained for reference \"refs/A\"") |
| 39 | 36 | } |
| @@ -113,10 +113,10 @@ pub mod baseline { · 112 unmodified lines | ||
| 113 | 113 | Err(e) if e.to_string() == err => { |
| 114 | 114 | saw_err = true; |
| 115 | 115 | } |
| 116 | − Err(err) => panic!("Unexpected parse error: {:?}", err), | |
| 116 | + Err(err) => panic!("Unexpected parse error: {err:?}"), | |
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | − assert!(saw_err, "Failed to see error when parsing specs: {:?}", err) | |
| 119 | + assert!(saw_err, "Failed to see error when parsing specs: {err:?}") | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /// Here we checked by hand which refs are actually written with a particular refspec |
| @@ -143,7 +143,7 @@ pub mod baseline { · 20 unmodified lines | ||
| 143 | 143 | let key: Vec<_> = specs.into_iter().map(BString::from).collect(); |
| 144 | 144 | let expected = BASELINE |
| 145 | 145 | .get(&key) |
| 146 | − .unwrap_or_else(|| panic!("BUG: Need {:?} added to the baseline", key)) | |
| 146 | + .unwrap_or_else(|| panic!("BUG: Need {key:?} added to the baseline")) | |
| 147 | 147 | .as_ref(); |
| 148 | 148 | |
| 149 | 149 | let actual = match_group.match_remotes(input()).validated(); |
| @@ -175,22 +175,15 @@ pub mod baseline { · 25 unmodified lines | ||
| 175 | 175 | assert_eq!( |
| 176 | 176 | actual.len(), |
| 177 | 177 | expected.len(), |
| 178 | − "got a different amount of mappings: {:?} != {:?}", | |
| 179 | − actual, | |
| 180 | − expected | |
| 178 | + "got a different amount of mappings: {actual:?} != {expected:?}" | |
| 181 | 179 | ); |
| 182 | 180 | |
| 183 | 181 | for (idx, (actual, expected)) in actual.iter().zip(expected).enumerate() { |
| 184 | − assert_eq!( | |
| 185 | − source_to_bstring(actual.lhs), | |
| 186 | − expected.remote, | |
| 187 | − "{}: remote mismatch", | |
| 188 | − idx | |
| 189 | − ); | |
| 182 | + assert_eq!(source_to_bstring(actual.lhs), expected.remote, "{idx}: remote mismatch"); | |
| 190 | 183 | if let Some(expected) = expected.local.as_ref() { |
| 191 | 184 | match actual.rhs.as_ref() { |
| 192 | − None => panic!("{}: Expected local ref to be {}, got none", idx, expected), | |
| 193 | − Some(actual) => assert_eq!(actual.as_ref(), expected, "{}: mismatched local ref", idx), | |
| 185 | + None => panic!("{idx}: Expected local ref to be {expected}, got none"), | |
| 186 | + Some(actual) => assert_eq!(actual.as_ref(), expected, "{idx}: mismatched local ref"), | |
| 194 | 187 | } |
| 195 | 188 | } |
| 196 | 189 | } |
| @@ -12,6 +12,7 @@ use crate::{ · 11 unmodified lines | ||
| 12 | 12 | Repository, |
| 13 | 13 | }; |
| 14 | 14 | |
| 15 | +#[allow(clippy::result_large_err)] | |
| 15 | 16 | pub fn write_remote_to_local_config_file( |
| 16 | 17 | remote: &mut crate::Remote<'_>, |
| 17 | 18 | remote_name: BString, |
| @@ -1,3 +1,4 @@ | ||
| 1 | +#![allow(clippy::result_large_err)] | |
| 1 | 2 | use std::convert::TryInto; |
| 2 | 3 | |
| 3 | 4 | use crate::bstr::BString; |
| @@ -1,3 +1,4 @@ | ||
| 1 | +#![allow(clippy::result_large_err)] | |
| 1 | 2 | use std::{borrow::Cow, path::PathBuf, time::Duration}; |
| 2 | 3 | |
| 3 | 4 | use git_lock::acquire::Fail; |
| @@ -1,3 +1,4 @@ | ||
| 1 | +#![allow(clippy::result_large_err)] | |
| 1 | 2 | use super::{util, Error}; |
| 2 | 3 | use crate::config::tree::{Core, Extensions}; |
| 3 | 4 | |
| @@ -1,3 +1,4 @@ | ||
| 1 | +#![allow(clippy::result_large_err)] | |
| 1 | 2 | use std::borrow::Cow; |
| 2 | 3 | |
| 3 | 4 | use git_sec::Permission; |
| @@ -1,3 +1,4 @@ | ||
| 1 | +#![allow(clippy::result_large_err)] | |
| 1 | 2 | use super::Error; |
| 2 | 3 | use crate::{ |
| 3 | 4 | config, |
| @@ -102,7 +103,7 @@ pub(crate) fn disambiguate_hint( · 98 unmodified lines | ||
| 102 | 103 | lenient_config: bool, |
| 103 | 104 | ) -> Result<Option<ObjectKindHint>, config::key::GenericErrorWithValue> { |
| 104 | 105 | match config.string_by_key("core.disambiguate") { |
| 105 | − None => return Ok(None), | |
| 106 | + None => Ok(None), | |
| 106 | 107 | Some(value) => Core::DISAMBIGUATE |
| 107 | 108 | .try_into_object_kind_hint(value) |
| 108 | 109 | .with_leniency(lenient_config), |
| @@ -124,7 +124,7 @@ pub mod protocol { · 123 unmodified lines | ||
| 124 | 124 | /// The error returned when obtaining the permission for a particular scheme. |
| 125 | 125 | #[derive(Debug, thiserror::Error)] |
| 126 | 126 | #[allow(missing_docs)] |
| 127 | − #[error("The value {value:?} must be allow|deny|user in configuration key protocol{0}.allow", scheme.as_ref().map(|s| format!(".{}", s)).unwrap_or_default())] | |
| 127 | + #[error("The value {value:?} must be allow|deny|user in configuration key protocol{0}.allow", scheme.as_ref().map(|s| format!(".{s}")).unwrap_or_default())] | |
| 128 | 128 | pub struct Error { |
| 129 | 129 | pub scheme: Option<String>, |
| 130 | 130 | pub value: BString, |
| @@ -1,3 +1,4 @@ | ||
| 1 | +#![allow(clippy::result_large_err)] | |
| 1 | 2 | use std::borrow::Cow; |
| 2 | 3 | |
| 3 | 4 | use git_features::threading::OwnShared; |
| @@ -1,3 +1,4 @@ | ||
| 1 | +#![allow(clippy::result_large_err)] | |
| 1 | 2 | use std::{ |
| 2 | 3 | borrow::Cow, |
| 3 | 4 | error::Error, |
| @@ -452,6 +453,7 @@ mod remote_name { · 448 unmodified lines | ||
| 452 | 453 | } |
| 453 | 454 | |
| 454 | 455 | /// Try to validate `name` as symbolic remote name and return it. |
| 456 | + #[allow(clippy::result_large_err)] | |
| 455 | 457 | pub fn try_into_symbolic_name( |
| 456 | 458 | &'static self, |
| 457 | 459 | name: Cow<'_, BStr>, |
| @@ -115,7 +115,7 @@ mod disambiguate { · 114 unmodified lines | ||
| 115 | 115 | |
| 116 | 116 | impl Disambiguate { |
| 117 | 117 | /// Convert a disambiguation marker into the respective enum. |
| 118 | − pub fn try_into_object_kind_hint<'a>( | |
| 118 | + pub fn try_into_object_kind_hint( | |
| 119 | 119 | &'static self, |
| 120 | 120 | value: Cow<'_, BStr>, |
| 121 | 121 | ) -> Result<Option<ObjectKindHint>, config::key::GenericErrorWithValue> { |
| @@ -1,3 +1,4 @@ | ||
| 1 | +#![allow(clippy::result_large_err)] | |
| 1 | 2 | use std::path::Path; |
| 2 | 3 | |
| 3 | 4 | pub use git_discover::*; |
| @@ -1,3 +1,4 @@ | ||
| 1 | +#![allow(clippy::result_large_err)] | |
| 1 | 2 | use std::{borrow::Cow, convert::TryInto, path::Path}; |
| 2 | 3 | |
| 3 | 4 | use git_ref::{ |
| @@ -140,16 +140,19 @@ pub mod progress { · 139 unmodified lines | ||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /// See [ThreadSafeRepository::discover()], but returns a [`Repository`] instead. |
| 143 | +#[allow(clippy::result_large_err)] | |
| 143 | 144 | pub fn discover(directory: impl AsRef<std::path::Path>) -> Result<Repository, discover::Error> { |
| 144 | 145 | ThreadSafeRepository::discover(directory).map(Into::into) |
| 145 | 146 | } |
| 146 | 147 | |
| 147 | 148 | /// See [ThreadSafeRepository::init()], but returns a [`Repository`] instead. |
| 149 | +#[allow(clippy::result_large_err)] | |
| 148 | 150 | pub fn init(directory: impl AsRef<std::path::Path>) -> Result<Repository, init::Error> { |
| 149 | 151 | ThreadSafeRepository::init(directory, create::Kind::WithWorktree, create::Options::default()).map(Into::into) |
| 150 | 152 | } |
| 151 | 153 | |
| 152 | 154 | /// See [ThreadSafeRepository::init()], but returns a [`Repository`] instead. |
| 155 | +#[allow(clippy::result_large_err)] | |
| 153 | 156 | pub fn init_bare(directory: impl AsRef<std::path::Path>) -> Result<Repository, init::Error> { |
| 154 | 157 | ThreadSafeRepository::init(directory, create::Kind::Bare, create::Options::default()).map(Into::into) |
| 155 | 158 | } |
| @@ -203,11 +206,13 @@ fn open_opts_with_git_binary_config() -> open::Options { · 47 unmodified lines | ||
| 203 | 206 | } |
| 204 | 207 | |
| 205 | 208 | /// See [ThreadSafeRepository::open()], but returns a [`Repository`] instead. |
| 209 | +#[allow(clippy::result_large_err)] | |
| 206 | 210 | pub fn open(directory: impl Into<std::path::PathBuf>) -> Result<Repository, open::Error> { |
| 207 | 211 | ThreadSafeRepository::open(directory).map(Into::into) |
| 208 | 212 | } |
| 209 | 213 | |
| 210 | 214 | /// See [ThreadSafeRepository::open_opts()], but returns a [`Repository`] instead. |
| 215 | +#[allow(clippy::result_large_err)] | |
| 211 | 216 | pub fn open_opts(directory: impl Into<std::path::PathBuf>, options: open::Options) -> Result<Repository, open::Error> { |
| 212 | 217 | ThreadSafeRepository::open_opts(directory, options).map(Into::into) |
| 213 | 218 | } |
| @@ -61,9 +61,7 @@ mod tests { · 60 unmodified lines | ||
| 61 | 61 | let limit = 160; |
| 62 | 62 | assert!( |
| 63 | 63 | actual <= limit, |
| 64 | − "{} <= {}: size shouldn't change without us knowing (on windows, it's bigger)", | |
| 65 | − actual, | |
| 66 | − limit | |
| 64 | + "{actual} <= {limit}: size shouldn't change without us knowing (on windows, it's bigger)" | |
| 67 | 65 | ); |
| 68 | 66 | } |
| 69 | 67 | } |
| @@ -140,6 +140,7 @@ impl Options { · 139 unmodified lines | ||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /// Open a repository at `path` with the options set so far. |
| 143 | + #[allow(clippy::result_large_err)] | |
| 143 | 144 | pub fn open(self, path: impl Into<PathBuf>) -> Result<ThreadSafeRepository, Error> { |
| 144 | 145 | ThreadSafeRepository::open_opts(path, self) |
| 145 | 146 | } |
| @@ -1,3 +1,4 @@ | ||
| 1 | +#![allow(clippy::result_large_err)] | |
| 1 | 2 | use std::{borrow::Cow, path::PathBuf}; |
| 2 | 3 | |
| 3 | 4 | use git_features::threading::OwnShared; |
| @@ -27,6 +27,7 @@ pub mod set_target_id { · 26 unmodified lines | ||
| 27 | 27 | /// Furthermore, refrain from using this method for more than a one-off change as it creates a transaction for each invocation. |
| 28 | 28 | /// If multiple reference should be changed, use [Repository::edit_references()][crate::Repository::edit_references()] |
| 29 | 29 | /// or the lower level reference database instead. |
| 30 | + #[allow(clippy::result_large_err)] | |
| 30 | 31 | pub fn set_target_id( |
| 31 | 32 | &mut self, |
| 32 | 33 | id: impl Into<git_hash::ObjectId>, |
| @@ -1,3 +1,4 @@ | ||
| 1 | +#![allow(clippy::result_large_err)] | |
| 1 | 2 | use git_protocol::transport::client::Transport; |
| 2 | 3 | |
| 3 | 4 | use crate::{remote::Connection, Progress, Remote}; |
| @@ -32,7 +32,7 @@ pub enum RefLogMessage { · 31 unmodified lines | ||
| 32 | 32 | impl RefLogMessage { |
| 33 | 33 | pub(crate) fn compose(&self, context: &str) -> BString { |
| 34 | 34 | match self { |
| 35 | − RefLogMessage::Prefixed { action } => format!("{}: {}", action, context).into(), | |
| 35 | + RefLogMessage::Prefixed { action } => format!("{action}: {context}").into(), | |
| 36 | 36 | RefLogMessage::Override { message } => message.to_owned(), |
| 37 | 37 | } |
| 38 | 38 | } |
| @@ -98,7 +98,7 @@ where · 97 unmodified lines | ||
| 98 | 98 | |
| 99 | 99 | let reader = 'negotiation: loop { |
| 100 | 100 | progress.step(); |
| 101 | − progress.set_name(format!("negotiate (round {})", round)); | |
| 101 | + progress.set_name(format!("negotiate (round {round})")); | |
| 102 | 102 | |
| 103 | 103 | let is_done = match negotiate::one_round( |
| 104 | 104 | negotiate::Algorithm::Naive, |
| @@ -1,3 +1,4 @@ | ||
| 1 | +#![allow(clippy::result_large_err)] | |
| 1 | 2 | use std::{collections::BTreeMap, convert::TryInto, path::PathBuf}; |
| 2 | 3 | |
| 3 | 4 | use git_odb::{Find, FindExt}; |
| @@ -160,9 +160,8 @@ mod update { · 159 unmodified lines | ||
| 160 | 160 | Change::Update { log, new, .. } => { |
| 161 | 161 | assert_eq!( |
| 162 | 162 | log.message, |
| 163 | − format!("action: {}", reflog_message), | |
| 164 | − "{}: reflog messages are specific and we emulate git word for word", | |
| 165 | − spec | |
| 163 | + format!("action: {reflog_message}"), | |
| 164 | + "{spec}: reflog messages are specific and we emulate git word for word" | |
| 166 | 165 | ); |
| 167 | 166 | let remote_ref = repo |
| 168 | 167 | .find_reference(specs[0].to_ref().source().expect("always present")) |
| @@ -195,7 +194,7 @@ mod update { · 26 unmodified lines | ||
| 195 | 194 | ("wt-c-locked", "wt-c-locked"), |
| 196 | 195 | ("wt-deleted", "wt-deleted"), |
| 197 | 196 | ] { |
| 198 | − let spec = format!("refs/heads/main:refs/heads/{}", branch); | |
| 197 | + let spec = format!("refs/heads/main:refs/heads/{branch}"); | |
| 199 | 198 | let (mappings, specs) = mapping_from_spec(&spec, &repo); |
| 200 | 199 | let out = fetch::refs::update( |
| 201 | 200 | &repo, |
| @@ -216,7 +215,7 @@ mod update { · 14 unmodified lines | ||
| 216 | 215 | }, |
| 217 | 216 | edit_index: None, |
| 218 | 217 | }], |
| 219 | − "{}: checked-out checks are done before checking if a change would actually be required (here it isn't)", spec | |
| 218 | + "{spec}: checked-out checks are done before checking if a change would actually be required (here it isn't)" | |
| 220 | 219 | ); |
| 221 | 220 | assert_eq!(out.edits.len(), 0); |
| 222 | 221 | } |
| @@ -81,7 +81,7 @@ impl std::fmt::Display for Mode { · 80 unmodified lines | ||
| 81 | 81 | Mode::Forced => "forced-update", |
| 82 | 82 | Mode::New => "new", |
| 83 | 83 | Mode::ImplicitTagNotSentByRemote => "unrelated tag on remote", |
| 84 | − Mode::RejectedSourceObjectNotFound { id } => return write!(f, "rejected ({} not found)", id), | |
| 84 | + Mode::RejectedSourceObjectNotFound { id } => return write!(f, "rejected ({id} not found)"), | |
| 85 | 85 | Mode::RejectedTagUpdate => "rejected (would overwrite existing tag)", |
| 86 | 86 | Mode::RejectedNonFastForward => "rejected (non-fast-forward)", |
| 87 | 87 | Mode::RejectedSymbolic => "rejected (refusing to write symbolic refs)", |
| @@ -1,3 +1,4 @@ | ||
| 1 | +#![allow(clippy::result_large_err)] | |
| 1 | 2 | use std::any::Any; |
| 2 | 3 | |
| 3 | 4 | use crate::bstr::BStr; |
| @@ -170,7 +171,7 @@ impl crate::Repository { · 166 unmodified lines | ||
| 170 | 171 | .with_leniency(lenient) |
| 171 | 172 | }, |
| 172 | 173 | ) |
| 173 | − .map_err(|err| config::transport::http::Error::InvalidFollowRedirects(err))? | |
| 174 | + .map_err(config::transport::http::Error::InvalidFollowRedirects)? | |
| 174 | 175 | }; |
| 175 | 176 | |
| 176 | 177 | opts.low_speed_time_seconds = config |
| @@ -178,14 +179,14 @@ impl crate::Repository { · 1 unmodified line | ||
| 178 | 179 | .map(|value| config::tree::Http::LOW_SPEED_TIME.try_into_u64(value)) |
| 179 | 180 | .transpose() |
| 180 | 181 | .with_leniency(lenient) |
| 181 | − .map_err(|err| config::transport::http::Error::from(err))? | |
| 182 | + .map_err(config::transport::http::Error::from)? | |
| 182 | 183 | .unwrap_or_default(); |
| 183 | 184 | opts.low_speed_limit_bytes_per_second = config |
| 184 | 185 | .integer_filter_by_key("http.lowSpeedLimit", &mut trusted_only) |
| 185 | 186 | .map(|value| config::tree::Http::LOW_SPEED_LIMIT.try_into_u32(value)) |
| 186 | 187 | .transpose() |
| 187 | 188 | .with_leniency(lenient) |
| 188 | − .map_err(|err| config::transport::http::Error::from(err))? | |
| 189 | + .map_err(config::transport::http::Error::from)? | |
| 189 | 190 | .unwrap_or_default(); |
| 190 | 191 | opts.proxy = proxy( |
| 191 | 192 | remote_name |
| @@ -1,3 +1,4 @@ | ||
| 1 | +#![allow(clippy::result_large_err)] | |
| 1 | 2 | use std::convert::TryInto; |
| 2 | 3 | |
| 3 | 4 | use git_hash::ObjectId; |
| @@ -1,3 +1,4 @@ | ||
| 1 | +#![allow(clippy::result_large_err)] | |
| 1 | 2 | use std::convert::TryInto; |
| 2 | 3 | |
| 3 | 4 | use crate::{bstr::BStr, config, remote, remote::find, Remote}; |
| @@ -33,6 +33,7 @@ impl crate::Repository { · 32 unmodified lines | ||
| 33 | 33 | /// |
| 34 | 34 | /// Note that it might be the one that is currently open if this repository doesn't point to a linked worktree. |
| 35 | 35 | /// Also note that the main repo might be bare. |
| 36 | + #[allow(clippy::result_large_err)] | |
| 36 | 37 | pub fn main_repo(&self) -> Result<crate::Repository, crate::open::Error> { |
| 37 | 38 | crate::ThreadSafeRepository::open_opts(self.common_dir(), self.options.clone()).map(Into::into) |
| 38 | 39 | } |
| @@ -35,11 +35,11 @@ pub enum CandidateInfo { · 34 unmodified lines | ||
| 35 | 35 | impl std::fmt::Display for CandidateInfo { |
| 36 | 36 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
| 37 | 37 | match self { |
| 38 | − CandidateInfo::FindError { source } => write!(f, "lookup error: {}", source), | |
| 39 | − CandidateInfo::Tag { name } => write!(f, "tag {:?}", name), | |
| 38 | + CandidateInfo::FindError { source } => write!(f, "lookup error: {source}"), | |
| 39 | + CandidateInfo::Tag { name } => write!(f, "tag {name:?}"), | |
| 40 | 40 | CandidateInfo::Object { kind } => std::fmt::Display::fmt(kind, f), |
| 41 | 41 | CandidateInfo::Commit { date, title } => { |
| 42 | − write!(f, "commit {} {:?}", date.format(git_date::time::format::SHORT), title) | |
| 42 | + write!(f, "commit {} {title:?}", date.format(git_date::time::format::SHORT)) | |
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | } |
| @@ -1,3 +1,4 @@ | ||
| 1 | +#![allow(clippy::result_large_err)] | |
| 1 | 2 | use std::path::{Path, PathBuf}; |
| 2 | 3 | |
| 3 | 4 | use crate::{ |
| @@ -1,3 +1,4 @@ | ||
| 1 | +#![allow(clippy::result_large_err)] | |
| 1 | 2 | use git_repository::{open, Repository, ThreadSafeRepository}; |
| 2 | 3 | use git_testtools::tempfile; |
| 3 | 4 | |
| @@ -88,7 +88,7 @@ impl<'a> Display for Format<'a> { · 87 unmodified lines | ||
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | if let Some(suffix) = &self.dirty_suffix { |
| 91 | − write!(f, "-{}", suffix)?; | |
| 91 | + write!(f, "-{suffix}")?; | |
| 92 | 92 | } |
| 93 | 93 | Ok(()) |
| 94 | 94 | } |
| @@ -66,11 +66,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { · 65 unmodified lines | ||
| 66 | 66 | ); |
| 67 | 67 | } |
| 68 | 68 | if let Err(err) = tmp.close() { |
| 69 | − eprintln!("Error when removing tempdir: {}", err); | |
| 69 | + eprintln!("Error when removing tempdir: {err}"); | |
| 70 | 70 | } |
| 71 | 71 | eprintln!( |
| 72 | − "OK: survived {}s without deadlock with {} tempfiles created, lock obtained {} times, cleanup handler ran {} times", | |
| 73 | − secs_to_run, | |
| 72 | + "OK: survived {secs_to_run}s without deadlock with {} tempfiles created, lock obtained {} times, cleanup handler ran {} times", | |
| 74 | 73 | tempfiles_created.load(Ordering::SeqCst), |
| 75 | 74 | tempfiles_registry_locked.load(Ordering::SeqCst), |
| 76 | 75 | signal_raised.load(Ordering::SeqCst) |
| @@ -88,7 +87,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { · 11 unmodified lines | ||
| 88 | 87 | |
| 89 | 88 | fn tempfile_for_thread_or_panic(tid: i32, tmp: &Path, count: &AtomicUsize) -> Handle<Writable> { |
| 90 | 89 | let res = git_tempfile::writable_at( |
| 91 | − tmp.join(format!("thread-{}", tid)), | |
| 90 | + tmp.join(format!("thread-{tid}")), | |
| 92 | 91 | ContainingDirectory::Exists, |
| 93 | 92 | AutoRemove::Tempfile, |
| 94 | 93 | ) |
| @@ -63,8 +63,7 @@ mod error { · 62 unmodified lines | ||
| 63 | 63 | retries, |
| 64 | 64 | } => write!( |
| 65 | 65 | f, |
| 66 | − "Permanently failing to create directory {:?} ({:?} of {:?})", | |
| 67 | − dir, retries_left, retries | |
| 66 | + "Permanently failing to create directory {dir:?} ({retries_left:?} of {retries:?})", | |
| 68 | 67 | ), |
| 69 | 68 | } |
| 70 | 69 | } |
| @@ -20,10 +20,7 @@ impl<'a> Iter<'a> { · 19 unmodified lines | ||
| 20 | 20 | if !target.starts_with(boundary) { |
| 21 | 21 | return Err(std::io::Error::new( |
| 22 | 22 | std::io::ErrorKind::InvalidInput, |
| 23 | − format!( | |
| 24 | − "Removal target {:?} must be contained in boundary {:?}", | |
| 25 | − target, boundary | |
| 26 | − ), | |
| 23 | + format!("Removal target {target:?} must be contained in boundary {boundary:?}"), | |
| 27 | 24 | )); |
| 28 | 25 | } |
| 29 | 26 | let cursor = if target == boundary { |
| @@ -54,7 +54,7 @@ impl Handler { · 53 unmodified lines | ||
| 54 | 54 | }; |
| 55 | 55 | match Self::parse_status_inner(data) { |
| 56 | 56 | Ok(status) if !(200..=valid_end).contains(&status) => { |
| 57 | − Some((status, format!("Received HTTP status {}", status).into())) | |
| 57 | + Some((status, format!("Received HTTP status {status}").into())) | |
| 58 | 58 | } |
| 59 | 59 | Ok(_) => None, |
| 60 | 60 | Err(err) => Some((500, err)), |
| @@ -252,8 +252,7 @@ impl<H: Http> Transport<H> { · 251 unmodified lines | ||
| 252 | 252 | }) { |
| 253 | 253 | return Err(client::Error::Http(Error::Detail { |
| 254 | 254 | description: format!( |
| 255 | − "Didn't find '{}' header to indicate 'smart' protocol, and 'dumb' protocol is not supported.", | |
| 256 | − wanted_content_type | |
| 255 | + "Didn't find '{wanted_content_type}' header to indicate 'smart' protocol, and 'dumb' protocol is not supported." | |
| 257 | 256 | ), |
| 258 | 257 | })); |
| 259 | 258 | } |
| @@ -271,7 +270,7 @@ impl<H: Http> Transport<H> { · 11 unmodified lines | ||
| 271 | 270 | } |
| 272 | 271 | headers.push(Cow::Owned(format!( |
| 273 | 272 | "Authorization: Basic {}", |
| 274 | − base64::engine::general_purpose::STANDARD.encode(format!("{}:{}", username, password)) | |
| 273 | + base64::engine::general_purpose::STANDARD.encode(format!("{username}:{password}")) | |
| 275 | 274 | ))) |
| 276 | 275 | } |
| 277 | 276 | Ok(()) |
| @@ -377,13 +376,13 @@ impl<H: Http> client::Transport for Transport<H> { · 99 unmodified lines | ||
| 377 | 376 | &extra_parameters |
| 378 | 377 | .iter() |
| 379 | 378 | .map(|(key, value)| match value { |
| 380 | − Some(value) => format!("{}={}", key, value), | |
| 379 | + Some(value) => format!("{key}={value}"), | |
| 381 | 380 | None => key.to_string(), |
| 382 | 381 | }) |
| 383 | 382 | .collect::<Vec<_>>() |
| 384 | 383 | .join(":"), |
| 385 | 384 | ); |
| 386 | − dynamic_headers.push(format!("Git-Protocol: {}", parameters).into()); | |
| 385 | + dynamic_headers.push(format!("Git-Protocol: {parameters}").into()); | |
| 387 | 386 | } |
| 388 | 387 | self.add_basic_auth_if_present(&mut dynamic_headers)?; |
| 389 | 388 | let GetResponse { headers, body } = |
| @@ -40,7 +40,7 @@ impl ProgramKind { · 39 unmodified lines | ||
| 40 | 40 | .env("GIT_PROTOCOL", format!("version={}", desired_version as usize)) |
| 41 | 41 | } |
| 42 | 42 | if let Some(port) = url.port { |
| 43 | − prepare = prepare.arg(format!("-p{}", port)); | |
| 43 | + prepare = prepare.arg(format!("-p{port}")); | |
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | ProgramKind::Plink | ProgramKind::Putty | ProgramKind::TortoisePlink => { |
| @@ -83,10 +83,10 @@ impl<T: Transport> TransportV2Ext for T { · 82 unmodified lines | ||
| 83 | 83 | arguments: Option<impl Iterator<Item = BString>>, |
| 84 | 84 | ) -> Result<Box<dyn ExtendedBufRead + Unpin + '_>, Error> { |
| 85 | 85 | let mut writer = self.request(WriteMode::OneLfTerminatedLinePerWriteCall, MessageKind::Flush)?; |
| 86 | − writer.write_all(format!("command={}", command).as_bytes())?; | |
| 86 | + writer.write_all(format!("command={command}").as_bytes())?; | |
| 87 | 87 | for (name, value) in capabilities { |
| 88 | 88 | match value { |
| 89 | − Some(value) => writer.write_all(format!("{}={}", name, value.as_ref()).as_bytes()), | |
| 89 | + Some(value) => writer.write_all(format!("{name}={}", value.as_ref()).as_bytes()), | |
| 90 | 90 | None => writer.write_all(name.as_bytes()), |
| 91 | 91 | }?; |
| 92 | 92 | } |
| @@ -64,7 +64,7 @@ mod message { · 63 unmodified lines | ||
| 64 | 64 | out.extend_from_slice(host.as_bytes()); |
| 65 | 65 | if let Some(port) = port { |
| 66 | 66 | out.push_byte(b':'); |
| 67 | − out.push_str(&format!("{}", port)); | |
| 67 | + out.push_str(&format!("{port}")); | |
| 68 | 68 | } |
| 69 | 69 | out.push(0); |
| 70 | 70 | } |
| @@ -87,7 +87,7 @@ mod message { · 16 unmodified lines | ||
| 87 | 87 | } |
| 88 | 88 | for (key, value) in extra_parameters { |
| 89 | 89 | match value { |
| 90 | − Some(value) => out.push_str(format!("{}={}", key, value)), | |
| 90 | + Some(value) => out.push_str(format!("{key}={value}")), | |
| 91 | 91 | None => out.push_str(key), |
| 92 | 92 | } |
| 93 | 93 | out.push(0); |
| @@ -23,18 +23,18 @@ fn assert_error_status( · 22 unmodified lines | ||
| 23 | 23 | kind: std::io::ErrorKind, |
| 24 | 24 | ) -> Result<(mock::Server, http::Transport<http::Impl>), crate::Error> { |
| 25 | 25 | let (server, mut client) = |
| 26 | − mock::serve_and_connect(&format!("http-{}.response", status), "path/not-important", Protocol::V1)?; | |
| 26 | + mock::serve_and_connect(&format!("http-{status}.response"), "path/not-important", Protocol::V1)?; | |
| 27 | 27 | let error = client |
| 28 | 28 | .handshake(Service::UploadPack, &[]) |
| 29 | 29 | .err() |
| 30 | 30 | .expect("non-200 status causes error"); |
| 31 | 31 | let error = error |
| 32 | 32 | .source() |
| 33 | − .unwrap_or_else(|| panic!("no source() in: {:?} ", error)) | |
| 33 | + .unwrap_or_else(|| panic!("no source() in: {error:?} ")) | |
| 34 | 34 | .downcast_ref::<std::io::Error>() |
| 35 | 35 | .expect("io error as source"); |
| 36 | 36 | assert_eq!(error.kind(), kind); |
| 37 | − let expected = format!("Received HTTP status {}", status); | |
| 37 | + let expected = format!("Received HTTP status {status}"); | |
| 38 | 38 | assert_eq!(error.to_string().get(..expected.len()), Some(expected).as_deref()); |
| 39 | 39 | drop(server.received()); |
| 40 | 40 | Ok((server, client)) |
| @@ -28,7 +28,7 @@ impl From<ForUser> for Option<BString> { · 27 unmodified lines | ||
| 28 | 28 | pub enum Error { |
| 29 | 29 | #[error("UTF8 conversion on non-unix system failed for path: {path:?}")] |
| 30 | 30 | IllformedUtf8 { path: BString }, |
| 31 | − #[error("Home directory could not be obtained for {}", match user {Some(user) => format!("user '{}'", user), None => "current user".into()})] | |
| 31 | + #[error("Home directory could not be obtained for {}", match user {Some(user) => format!("user '{user}'"), None => "current user".into()})] | |
| 32 | 32 | MissingHome { user: Option<BString> }, |
| 33 | 33 | } |
| 34 | 34 | |
| @@ -188,7 +188,7 @@ impl Url { · 187 unmodified lines | ||
| 188 | 188 | (Some(_user), None) => unreachable!("BUG: should not be possible to have a user but no host"), |
| 189 | 189 | }; |
| 190 | 190 | if let Some(port) = &self.port { |
| 191 | − write!(&mut out, ":{}", port)?; | |
| 191 | + write!(&mut out, ":{port}")?; | |
| 192 | 192 | } |
| 193 | 193 | if self.serialize_alternative_form && self.scheme == Scheme::Ssh { |
| 194 | 194 | out.write_all(b":")?; |
| @@ -21,7 +21,7 @@ fn user_home(name: &str) -> std::path::PathBuf { · 20 unmodified lines | ||
| 21 | 21 | #[cfg(not(windows))] |
| 22 | 22 | fn user_home(name: &str) -> std::path::PathBuf { |
| 23 | 23 | #[cfg(not(windows))] |
| 24 | − format!("/home/{}", name).into() | |
| 24 | + format!("/home/{name}").into() | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | #[test] |
| @@ -29,7 +29,7 @@ fn without_username() -> crate::Result { · 1 unmodified line | ||
| 29 | 29 | let (user, resolved_path) = expand_path::parse(b"/~/hello/git".as_bstr())?; |
| 30 | 30 | let resolved_path = expand_path::with(user.as_ref(), resolved_path.as_ref(), |user: &ForUser| match user { |
| 31 | 31 | ForUser::Current => Some(user_home("byron")), |
| 32 | − ForUser::Name(name) => Some(format!("/home/{}", name).into()), | |
| 32 | + ForUser::Name(name) => Some(format!("/home/{name}").into()), | |
| 33 | 33 | })?; |
| 34 | 34 | assert_eq!(resolved_path, expected_path()); |
| 35 | 35 | Ok(()) |
| @@ -231,10 +231,10 @@ impl State { · 230 unmodified lines | ||
| 231 | 231 | /// - ignores entries which aren't blobs |
| 232 | 232 | /// - ignores ignore entries which are not skip-worktree |
| 233 | 233 | /// - within merges, picks 'our' stage both for ignore and attribute files. |
| 234 | − pub fn build_attribute_list<'paths>( | |
| 234 | + pub fn build_attribute_list( | |
| 235 | 235 | &self, |
| 236 | 236 | index: &git_index::State, |
| 237 | − paths: &'paths git_index::PathStorageRef, | |
| 237 | + paths: &git_index::PathStorageRef, | |
| 238 | 238 | case: Case, |
| 239 | 239 | ) -> Vec<PathOidMapping> { |
| 240 | 240 | let a1_backing; |
| @@ -183,7 +183,7 @@ pub fn spawn_git_daemon(working_dir: impl AsRef<Path>) -> std::io::Result<GitDae · 182 unmodified lines | ||
| 183 | 183 | } |
| 184 | 184 | Ok(GitDaemon { |
| 185 | 185 | child, |
| 186 | − url: format!("git://{}", server_addr), | |
| 186 | + url: format!("git://{server_addr}"), | |
| 187 | 187 | }) |
| 188 | 188 | } |
| 189 | 189 | |