···779779 // Check one isn't less than half the length of the other. If this is true then there is a
780780 // big difference in length.
781781 let big_len_diff = (n * 2) < m || (m * 2) < n;
782782- let len_diff = if n < m { m - n } else { n - m };
782782+ let len_diff = m.abs_diff(n);
783783 let distance = edit_distance(a, b, limit + len_diff)?;
784784785785 // This is the crux, subtracting length difference means exact substring matches will now be 0
···11351135 OS::MacOS => {
11361136 fn brew_install(name: &str, pkg: &str) -> String {
11371137 format!(
11381138- "\n\nYou can install {} via homebrew: brew install {}",
11391139- name, pkg
11381138+ "\n\nYou can install {name} via homebrew: brew install {pkg}",
11401139 )
11411140 }
11421141 match program.as_str() {
···11551154 OS::Linux(distro) => {
11561155 fn apt_install(name: &str, pkg: &str) -> String {
11571156 format!(
11581158- "\n\nYou can install {} via apt: sudo apt install {}",
11591159- name, pkg
11571157+ "\n\nYou can install {name} via apt: sudo apt install {pkg}"
11601158 )
11611159 }
11621160 match distro {
···12631261 reason: ShellCommandFailureReason::ShellCommandError(err),
12641262 } => {
12651263 let text = format!(
12661266- "There was a problem when running the shell command `{}`.
12641264+ "There was a problem when running the shell command `{command}`.
1267126512681266The error from the shell command was:
1269126712701270- {}",
12711271- command, err
12681268+ {err}"
12721269 );
12731270 vec![Diagnostic {
12741271 title: "Shell command failure".into(),
···408408 BitArrayMatchedValue::Variable(_)
409409 | BitArrayMatchedValue::Discard(_)
410410 | BitArrayMatchedValue::Assign { .. } => {
411411- panic!("aliased non constant value: {:#?}", value)
411411+ panic!("aliased non constant value: {value:#?}")
412412 }
413413 };
414414···28662866 type_ if type_.is_string() => ReadType::String,
28672867 type_ if type_.is_bit_array() => ReadType::BitArray,
28682868 type_ if type_.is_utf_codepoint() => ReadType::UtfCodepoint,
28692869- x => panic!("invalid segment type in exhaustiveness {:?}", x),
28692869+ x => panic!("invalid segment type in exhaustiveness {x:?}"),
28702870 };
2871287128722872 let read_action = ReadAction {
···29412941 name: name.clone(),
29422942 value: Box::new(segment_matched_value(segment, Some(pattern))),
29432943 },
29442944- x => panic!("unexpected segment value pattern {:?}", x),
29442944+ x => panic!("unexpected segment value pattern {x:?}"),
29452945 }
29462946}
29472947···29742974 unit: segment.unit(),
29752975 }
29762976 }
29772977- Some(x) => panic!("invalid pattern size made it to code generation {:?}", x),
29772977+ Some(x) => panic!("invalid pattern size made it to code generation {x:?}"),
2978297829792979 // If a segment has the `bits`/`bytes` option and has no size, that
29802980 // means it's the final catch all segment: we'll have to read any number
···1306130613071307 type_::Warning::TopLevelDefinitionShadowsImport { location, name } => {
13081308 let text = format!(
13091309- "Definition of {} shadows an imported value.
13101310-The imported value could not be used in this module anyway.",
13111311- name
13091309+ "Definition of {name} shadows an imported value.
13101310+The imported value could not be used in this module anyway."
13121311 );
13131312 Diagnostic {
13141313 title: "Shadowed Import".into(),
···13181317 path: path.clone(),
13191318 src: src.clone(),
13201319 label: diagnostic::Label {
13211321- text: Some(wrap(&format!("`{}` is defined here", name))),
13201320+ text: Some(wrap(&format!("`{name}` is defined here"))),
13221321 span: *location,
13231322 },
13241323 extra_labels: Vec::new(),