mirror of
https://github.com/openai/codex.git
synced 2026-04-24 22:54:54 +00:00
linter
This commit is contained in:
@@ -51,9 +51,15 @@ fn strip_surrounding_quotes(s: &str) -> String {
|
||||
return trimmed.to_string();
|
||||
}
|
||||
|
||||
let mut chars = trimmed.chars();
|
||||
let first = chars.next().unwrap();
|
||||
let last = trimmed.chars().last().unwrap();
|
||||
// Safely obtain the first and last characters without unwraps.
|
||||
let (first, last) = {
|
||||
let mut chs = trimmed.chars();
|
||||
match (chs.next(), chs.next_back()) {
|
||||
(Some(f), Some(l)) => (f, l),
|
||||
(Some(f), None) => (f, f),
|
||||
_ => return trimmed.to_string(),
|
||||
}
|
||||
};
|
||||
|
||||
let is_valid_quote = match first {
|
||||
'"' | '\'' | '“' | '‘' => first == last,
|
||||
|
||||
@@ -203,7 +203,7 @@ fn fuzzy_match(haystack: &str, needle: &str) -> Option<(Vec<usize>, i32)> {
|
||||
|
||||
for ch in n_lower.chars() {
|
||||
let mut found = None;
|
||||
while let Some((i, hc)) = h_iter.next() {
|
||||
for (i, hc) in h_iter.by_ref() {
|
||||
if hc == ch {
|
||||
found = Some(i);
|
||||
break;
|
||||
|
||||
@@ -531,7 +531,7 @@ impl ChatWidget<'_> {
|
||||
// Emit a lightweight event in the conversation log so the change is visible.
|
||||
if changed {
|
||||
self.conversation_history
|
||||
.add_background_event(format!("Set model to {}.", model));
|
||||
.add_background_event(format!("Set model to {model}."));
|
||||
self.emit_last_history_entry();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user