Skip to content

Commit

Permalink
fix new clippy in workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmoulton committed Dec 6, 2024
1 parent e96c39f commit 439548d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion editor-core/src/char_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl CharBuffer {
#[inline]
pub fn new(char: char) -> Self {
let mut buf = [0; 4];
let len = char.encode_utf8(&mut buf).as_bytes().len();
let len = char.encode_utf8(&mut buf).len();
Self { len, buf }
}

Expand Down
4 changes: 2 additions & 2 deletions examples/syntax-editor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct SyntaxHighlightingStyle<'a> {
pub states: RefCell<Vec<(ParseState, HighlightState)>>,
}

impl<'a> SyntaxHighlightingStyle<'a> {
impl SyntaxHighlightingStyle<'_> {
pub fn new(style: Rc<dyn Styling>) -> Self {
let theme = &THEMES.themes["base16-ocean.dark"];
let rust = SYNTAXSET.find_syntax_by_extension("rs").unwrap();
Expand All @@ -61,7 +61,7 @@ impl<'a> SyntaxHighlightingStyle<'a> {
}
}

impl<'a> Styling for SyntaxHighlightingStyle<'a> {
impl Styling for SyntaxHighlightingStyle<'_> {
fn id(&self) -> u64 {
self.style.id()
}
Expand Down
2 changes: 1 addition & 1 deletion examples/todo-complex/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ enum AppCommand<'a> {
SelectUp,
SelectDown,
}
impl<'a> AppCommand<'a> {
impl AppCommand<'_> {
fn execute(self) {
let (active, selected, todos) = TODOS_STATE.with(|s| (s.active, s.selected, s.todos));
TODOS_STATE.with(|s| {
Expand Down
3 changes: 1 addition & 2 deletions examples/todo-complex/src/todo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ impl IntoView for TodoState {
});

let (active, selected) = TODOS_STATE.with(|s| (s.active, s.selected));
let is_active =
create_memo(move |_| active.with(|a| a.active.map_or(false, |v| v == self)));
let is_active = create_memo(move |_| active.with(|a| (a.active == Some(self))));
let is_selected = create_memo(move |_| selected.with(|s| s.contains(&self)));

let todo_action_menu = move || {
Expand Down
2 changes: 1 addition & 1 deletion src/views/text_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ impl TextInput {
.key
.text
.as_ref()
.map_or(false, |ch| self.insert_text(ch)),
.is_some_and(|ch| self.insert_text(ch)),
Key::Named(NamedKey::Space) => {
if let Some(selection) = &self.selection {
self.buffer
Expand Down

0 comments on commit 439548d

Please sign in to comment.