Detailed changes
@@ -240,7 +240,7 @@ jobs:
timeout-minutes: 60
name: (Windows) Run Clippy and tests
if: github.repository_owner == 'zed-industries'
- runs-on: hosted-windows-1
+ runs-on: hosted-windows-2
steps:
# more info here:- https://github.com/rust-lang/cargo/issues/13020
- name: Enable longer pathnames for git
@@ -709,6 +709,9 @@ debug = "full"
lto = false
codegen-units = 16
+[workspace.lints.rust]
+unexpected_cfgs = { level = "allow" }
+
[workspace.lints.clippy]
dbg_macro = "deny"
todo = "deny"
@@ -109,7 +109,7 @@ impl sum_tree::Summary for DiffHunkSummary {
}
}
-impl<'a> sum_tree::SeekTarget<'a, DiffHunkSummary, DiffHunkSummary> for Anchor {
+impl sum_tree::SeekTarget<'_, DiffHunkSummary, DiffHunkSummary> for Anchor {
fn cmp(&self, cursor_location: &DiffHunkSummary, buffer: &text::BufferSnapshot) -> Ordering {
if self
.cmp(&cursor_location.buffer_range.start, buffer)
@@ -48,7 +48,7 @@ pub struct ChannelPathsInsertGuard<'a> {
channels_by_id: &'a mut BTreeMap<ChannelId, Arc<Channel>>,
}
-impl<'a> ChannelPathsInsertGuard<'a> {
+impl ChannelPathsInsertGuard<'_> {
pub fn insert(&mut self, channel_proto: proto::Channel) -> bool {
let mut ret = false;
let parent_path = channel_proto
@@ -86,7 +86,7 @@ impl<'a> ChannelPathsInsertGuard<'a> {
}
}
-impl<'a> Drop for ChannelPathsInsertGuard<'a> {
+impl Drop for ChannelPathsInsertGuard<'_> {
fn drop(&mut self) {
self.channels_ordered.sort_by(|a, b| {
let a = channel_path_sorting_key(*a, self.channels_by_id);
@@ -202,7 +202,7 @@ impl Database {
.await
}
- pub async fn get_known_extension_versions<'a>(&self) -> Result<HashMap<String, Vec<String>>> {
+ pub async fn get_known_extension_versions(&self) -> Result<HashMap<String, Vec<String>>> {
self.transaction(|tx| async move {
let mut extension_external_ids_by_id = HashMap::default();
@@ -975,7 +975,7 @@ impl Server {
}
}
-impl<'a> Deref for ConnectionPoolGuard<'a> {
+impl Deref for ConnectionPoolGuard<'_> {
type Target = ConnectionPool;
fn deref(&self) -> &Self::Target {
@@ -983,13 +983,13 @@ impl<'a> Deref for ConnectionPoolGuard<'a> {
}
}
-impl<'a> DerefMut for ConnectionPoolGuard<'a> {
+impl DerefMut for ConnectionPoolGuard<'_> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.guard
}
}
-impl<'a> Drop for ConnectionPoolGuard<'a> {
+impl Drop for ConnectionPoolGuard<'_> {
fn drop(&mut self) {
#[cfg(test)]
self.check_invariants();
@@ -27,7 +27,7 @@ impl<'de> Deserialize<'de> for ChatPanelButton {
{
struct Visitor;
- impl<'de> serde::de::Visitor<'de> for Visitor {
+ impl serde::de::Visitor<'_> for Visitor {
type Value = ChatPanelButton;
fn expecting(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
@@ -411,7 +411,7 @@ async fn stream_completion(
match serde_json::from_str::<ResponseEvent>(line) {
Ok(response) => {
- if response.choices.first().is_none()
+ if response.choices.is_empty()
|| response.choices.first().unwrap().finish_reason.is_some()
{
None
@@ -999,7 +999,7 @@ impl std::ops::DerefMut for BlockPoint {
}
}
-impl<'a> Deref for BlockMapReader<'a> {
+impl Deref for BlockMapReader<'_> {
type Target = BlockSnapshot;
fn deref(&self) -> &Self::Target {
@@ -1007,13 +1007,13 @@ impl<'a> Deref for BlockMapReader<'a> {
}
}
-impl<'a> DerefMut for BlockMapReader<'a> {
+impl DerefMut for BlockMapReader<'_> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.snapshot
}
}
-impl<'a> BlockMapReader<'a> {
+impl BlockMapReader<'_> {
pub fn row_for_block(&self, block_id: CustomBlockId) -> Option<BlockRow> {
let block = self.blocks.iter().find(|block| block.id == block_id)?;
let buffer_row = block
@@ -1053,7 +1053,7 @@ impl<'a> BlockMapReader<'a> {
}
}
-impl<'a> BlockMapWriter<'a> {
+impl BlockMapWriter<'_> {
pub fn insert(
&mut self,
blocks: impl IntoIterator<Item = BlockProperties<Anchor>>,
@@ -1740,7 +1740,7 @@ impl BlockSnapshot {
}
}
-impl<'a> BlockChunks<'a> {
+impl BlockChunks<'_> {
/// Go to the next transform
fn advance(&mut self) {
self.input_chunk = Chunk::default();
@@ -1856,7 +1856,7 @@ impl<'a> Iterator for BlockChunks<'a> {
}
}
-impl<'a> Iterator for BlockRows<'a> {
+impl Iterator for BlockRows<'_> {
type Item = RowInfo;
fn next(&mut self) -> Option<Self::Item> {
@@ -1952,7 +1952,7 @@ impl<'a> sum_tree::Dimension<'a, TransformSummary> for BlockRow {
}
}
-impl<'a> Deref for BlockContext<'a, '_> {
+impl Deref for BlockContext<'_, '_> {
type Target = App;
fn deref(&self) -> &Self::Target {
@@ -132,7 +132,7 @@ impl<'a> sum_tree::Dimension<'a, TransformSummary> for FoldPoint {
pub(crate) struct FoldMapWriter<'a>(&'a mut FoldMap);
-impl<'a> FoldMapWriter<'a> {
+impl FoldMapWriter<'_> {
pub(crate) fn fold<T: ToOffset>(
&mut self,
ranges: impl IntoIterator<Item = (Range<T>, FoldPlaceholder)>,
@@ -1121,7 +1121,7 @@ impl<'a> sum_tree::Dimension<'a, FoldSummary> for FoldRange {
}
}
-impl<'a> sum_tree::SeekTarget<'a, FoldSummary, FoldRange> for FoldRange {
+impl sum_tree::SeekTarget<'_, FoldSummary, FoldRange> for FoldRange {
fn cmp(&self, other: &Self, buffer: &MultiBufferSnapshot) -> Ordering {
AnchorRangeExt::cmp(&self.0, &other.0, buffer)
}
@@ -1144,7 +1144,7 @@ pub struct FoldRows<'a> {
fold_point: FoldPoint,
}
-impl<'a> FoldRows<'a> {
+impl FoldRows<'_> {
pub(crate) fn seek(&mut self, row: u32) {
let fold_point = FoldPoint::new(row, 0);
self.cursor.seek(&fold_point, Bias::Left, &());
@@ -1155,7 +1155,7 @@ impl<'a> FoldRows<'a> {
}
}
-impl<'a> Iterator for FoldRows<'a> {
+impl Iterator for FoldRows<'_> {
type Item = RowInfo;
fn next(&mut self) -> Option<Self::Item> {
@@ -1190,7 +1190,7 @@ pub struct FoldChunks<'a> {
max_output_offset: FoldOffset,
}
-impl<'a> FoldChunks<'a> {
+impl FoldChunks<'_> {
pub(crate) fn seek(&mut self, range: Range<FoldOffset>) {
self.transform_cursor.seek(&range.start, Bias::Right, &());
@@ -215,7 +215,7 @@ pub struct InlayChunks<'a> {
snapshot: &'a InlaySnapshot,
}
-impl<'a> InlayChunks<'a> {
+impl InlayChunks<'_> {
pub fn seek(&mut self, new_range: Range<InlayOffset>) {
self.transforms.seek(&new_range.start, Bias::Right, &());
@@ -341,7 +341,7 @@ impl<'a> Iterator for InlayChunks<'a> {
}
}
-impl<'a> InlayBufferRows<'a> {
+impl InlayBufferRows<'_> {
pub fn seek(&mut self, row: u32) {
let inlay_point = InlayPoint::new(row, 0);
self.transforms.seek(&inlay_point, Bias::Left, &());
@@ -363,7 +363,7 @@ impl<'a> InlayBufferRows<'a> {
}
}
-impl<'a> Iterator for InlayBufferRows<'a> {
+impl Iterator for InlayBufferRows<'_> {
type Item = RowInfo;
fn next(&mut self) -> Option<Self::Item> {
@@ -498,7 +498,7 @@ pub struct TabChunks<'a> {
inside_leading_tab: bool,
}
-impl<'a> TabChunks<'a> {
+impl TabChunks<'_> {
pub(crate) fn seek(&mut self, range: Range<TabPoint>) {
let (input_start, expanded_char_column, to_next_stop) =
self.snapshot.to_fold_point(range.start, Bias::Left);
@@ -69,7 +69,7 @@ pub struct WrapRows<'a> {
transforms: Cursor<'a, Transform, (WrapPoint, TabPoint)>,
}
-impl<'a> WrapRows<'a> {
+impl WrapRows<'_> {
pub(crate) fn seek(&mut self, start_row: u32) {
self.transforms
.seek(&WrapPoint::new(start_row, 0), Bias::Left, &());
@@ -872,7 +872,7 @@ impl WrapSnapshot {
}
}
-impl<'a> WrapChunks<'a> {
+impl WrapChunks<'_> {
pub(crate) fn seek(&mut self, rows: Range<u32>) {
let output_start = WrapPoint::new(rows.start, 0);
let output_end = WrapPoint::new(rows.end, 0);
@@ -955,7 +955,7 @@ impl<'a> Iterator for WrapChunks<'a> {
}
}
-impl<'a> Iterator for WrapRows<'a> {
+impl Iterator for WrapRows<'_> {
type Item = RowInfo;
fn next(&mut self) -> Option<Self::Item> {
@@ -1120,7 +1120,7 @@ impl<'a> sum_tree::Dimension<'a, TransformSummary> for TabPoint {
}
}
-impl<'a> sum_tree::SeekTarget<'a, TransformSummary, TransformSummary> for TabPoint {
+impl sum_tree::SeekTarget<'_, TransformSummary, TransformSummary> for TabPoint {
fn cmp(&self, cursor_location: &TransformSummary, _: &()) -> std::cmp::Ordering {
Ord::cmp(&self.0, &cursor_location.input.lines)
}
@@ -17393,7 +17393,7 @@ impl Focusable for Editor {
}
impl Render for Editor {
- fn render<'a>(&mut self, _: &mut Window, cx: &mut Context<'a, Self>) -> impl IntoElement {
+ fn render(&mut self, _: &mut Window, cx: &mut Context<'_, Self>) -> impl IntoElement {
let settings = ThemeSettings::get_global(cx);
let mut text_style = match self.mode {
@@ -177,7 +177,7 @@ impl<'de> Deserialize<'de> for ScrollbarDiagnostics {
{
struct Visitor;
- impl<'de> serde::de::Visitor<'de> for Visitor {
+ impl serde::de::Visitor<'_> for Visitor {
type Value = ScrollbarDiagnostics;
fn expecting(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
@@ -238,7 +238,7 @@ pub fn indented_line_beginning(
}
/// Returns a position of the end of line.
-
+///
/// If `stop_at_soft_boundaries` is true, the returned position is that of the
/// displayed line (e.g. it could actually be in the middle of a text line if that line is soft-wrapped).
/// Otherwise it's always going to be the end of a logical line.
@@ -843,14 +843,14 @@ impl<'a> MutableSelectionsCollection<'a> {
}
}
-impl<'a> Deref for MutableSelectionsCollection<'a> {
+impl Deref for MutableSelectionsCollection<'_> {
type Target = SelectionsCollection;
fn deref(&self) -> &Self::Target {
self.collection
}
}
-impl<'a> DerefMut for MutableSelectionsCollection<'a> {
+impl DerefMut for MutableSelectionsCollection<'_> {
fn deref_mut(&mut self) -> &mut Self::Target {
self.collection
}
@@ -181,7 +181,10 @@ pub fn register_extension(build_extension: fn() -> Box<dyn Extension>) {
}
fn extension() -> &'static mut dyn Extension {
- unsafe { EXTENSION.as_deref_mut().unwrap() }
+ #[expect(static_mut_refs)]
+ unsafe {
+ EXTENSION.as_deref_mut().unwrap()
+ }
}
static mut EXTENSION: Option<Box<dyn Extension>> = None;
@@ -78,10 +78,9 @@ impl HeadlessExtensionStore {
if e.dev {
return true;
}
- !self
- .loaded_extensions
+ self.loaded_extensions
.get(e.id.as_str())
- .is_some_and(|loaded| loaded.as_ref() == e.version.as_str())
+ .is_none_or(|loaded| loaded.as_ref() != e.version.as_str())
})
.collect();
@@ -348,7 +348,7 @@ impl Extension {
.call_labels_for_completions(
store,
&language_server_id.0,
- &completions.into_iter().map(Into::into).collect::<Vec<_>>(),
+ &completions.into_iter().collect::<Vec<_>>(),
)
.await?
.map(|labels| {
@@ -402,7 +402,7 @@ impl Extension {
.call_labels_for_symbols(
store,
&language_server_id.0,
- &symbols.into_iter().map(Into::into).collect::<Vec<_>>(),
+ &symbols.into_iter().collect::<Vec<_>>(),
)
.await?
.map(|labels| {
@@ -1451,9 +1451,9 @@ impl<'a> PathComponentSlice<'a> {
matches.next();
}
if is_first_normal || is_last || !is_normal || contains_match {
- if !longest
+ if longest
.as_ref()
- .is_some_and(|old| old.end - old.start > cur.end - cur.start)
+ .is_none_or(|old| old.end - old.start <= cur.end - cur.start)
{
longest = Some(cur);
}
@@ -1462,9 +1462,9 @@ impl<'a> PathComponentSlice<'a> {
cur.end = i + 1;
}
}
- if !longest
+ if longest
.as_ref()
- .is_some_and(|old| old.end - old.start > cur.end - cur.start)
+ .is_none_or(|old| old.end - old.start <= cur.end - cur.start)
{
longest = Some(cur);
}
@@ -108,7 +108,7 @@ impl Match {
fn styled_text(&self, project: &Project, window: &Window, cx: &App) -> StyledText {
let mut text = "./".to_string();
let mut highlights = Vec::new();
- let mut offset = text.as_bytes().len();
+ let mut offset = text.len();
let separator = '/';
let dir_indicator = "[…]";
@@ -125,7 +125,7 @@ impl Match {
highlights.push((range.start + offset..range.end + offset, style))
}
text.push(separator);
- offset = text.as_bytes().len();
+ offset = text.len();
if let Some(suffix) = &self.suffix {
text.push_str(suffix);
@@ -140,10 +140,10 @@ impl Match {
Color::Created
};
highlights.push((
- offset..offset + suffix.as_bytes().len(),
+ offset..offset + suffix.len(),
HighlightStyle::color(color.color(cx)),
));
- offset += suffix.as_bytes().len();
+ offset += suffix.len();
if entry.is_some_and(|e| e.is_dir()) {
text.push(separator);
offset += separator.len_utf8();
@@ -165,7 +165,7 @@ impl Match {
text.push_str(suffix);
let existing_prefix_len = self
.existing_prefix(project, cx)
- .map(|prefix| prefix.to_string_lossy().as_bytes().len())
+ .map(|prefix| prefix.to_string_lossy().len())
.unwrap_or(0);
if existing_prefix_len > 0 {
@@ -175,14 +175,14 @@ impl Match {
));
}
highlights.push((
- offset + existing_prefix_len..offset + suffix.as_bytes().len(),
+ offset + existing_prefix_len..offset + suffix.len(),
HighlightStyle::color(if self.entry(project, cx).is_some() {
Color::Conflict.color(cx)
} else {
Color::Created.color(cx)
}),
));
- offset += suffix.as_bytes().len();
+ offset += suffix.len();
if suffix.ends_with('/') {
text.push_str(dir_indicator);
highlights.push((
@@ -1261,7 +1261,7 @@ impl FakeFs {
self.with_git_state(dot_git, true, |state| {
let branch = branch.map(Into::into);
state.branches.extend(branch.clone());
- state.current_branch_name = branch.map(Into::into)
+ state.current_branch_name = branch
})
}
@@ -140,7 +140,7 @@ pub async fn match_path_sets<'a, Set: PathMatchCandidateSet<'a>>(
let query_char_bag = CharBag::from(&lowercase_query[..]);
let num_cpus = executor.num_cpus().min(path_count);
- let segment_size = (path_count + num_cpus - 1) / num_cpus;
+ let segment_size = path_count.div_ceil(num_cpus);
let mut segment_results = (0..num_cpus)
.map(|_| Vec::with_capacity(max_results))
.collect::<Vec<_>>();
@@ -145,7 +145,7 @@ pub async fn match_strings(
let query_char_bag = CharBag::from(&lowercase_query[..]);
let num_cpus = executor.num_cpus().min(candidates.len());
- let segment_size = (candidates.len() + num_cpus - 1) / num_cpus;
+ let segment_size = candidates.len().div_ceil(num_cpus);
let mut segment_results = (0..num_cpus)
.map(|_| Vec::with_capacity(max_results.min(candidates.len())))
.collect::<Vec<_>>();
@@ -344,7 +344,7 @@ mod tests {
have_json.push('\n');
let update = std::env::var("UPDATE_GOLDEN")
- .map(|val| val.to_ascii_lowercase() == "true")
+ .map(|val| val.eq_ignore_ascii_case("true"))
.unwrap_or(false);
if update {
@@ -1019,7 +1019,7 @@ impl Borrow<Path> for RepoPath {
#[derive(Debug)]
pub struct RepoPathDescendants<'a>(pub &'a Path);
-impl<'a> MapSeekTarget<RepoPath> for RepoPathDescendants<'a> {
+impl MapSeekTarget<RepoPath> for RepoPathDescendants<'_> {
fn cmp_cursor(&self, key: &RepoPath) -> Ordering {
if key.starts_with(self.0) {
Ordering::Greater
@@ -553,7 +553,7 @@ impl GitPanel {
}
fn select_first(&mut self, _: &SelectFirst, _window: &mut Window, cx: &mut Context<Self>) {
- if self.entries.first().is_some() {
+ if !self.entries.is_empty() {
self.selected_entry = Some(1);
self.scroll_to_selected_entry(cx);
}
@@ -82,7 +82,7 @@ impl AppCell {
#[derive(Deref, DerefMut)]
pub struct AppRef<'a>(Ref<'a, App>);
-impl<'a> Drop for AppRef<'a> {
+impl Drop for AppRef<'_> {
fn drop(&mut self) {
if option_env!("TRACK_THREAD_BORROWS").is_some() {
let thread_id = std::thread::current().id();
@@ -95,7 +95,7 @@ impl<'a> Drop for AppRef<'a> {
#[derive(Deref, DerefMut)]
pub struct AppRefMut<'a>(RefMut<'a, App>);
-impl<'a> Drop for AppRefMut<'a> {
+impl Drop for AppRefMut<'_> {
fn drop(&mut self) {
if option_env!("TRACK_THREAD_BORROWS").is_some() {
let thread_id = std::thread::current().id();
@@ -649,7 +649,7 @@ impl<'a, T: 'static> Context<'a, T> {
}
}
-impl<'a, T> Context<'a, T> {
+impl<T> Context<'_, T> {
/// Emit an event of the specified type, which can be handled by other entities that have subscribed via `subscribe` methods on their respective contexts.
pub fn emit<Evt>(&mut self, event: Evt)
where
@@ -664,7 +664,7 @@ impl<'a, T> Context<'a, T> {
}
}
-impl<'a, T> AppContext for Context<'a, T> {
+impl<T> AppContext for Context<'_, T> {
type Result<U> = U;
fn new<U: 'static>(
@@ -191,7 +191,7 @@ pub(crate) struct Lease<'a, T> {
entity_type: PhantomData<T>,
}
-impl<'a, T: 'static> core::ops::Deref for Lease<'a, T> {
+impl<T: 'static> core::ops::Deref for Lease<'_, T> {
type Target = T;
fn deref(&self) -> &Self::Target {
@@ -199,13 +199,13 @@ impl<'a, T: 'static> core::ops::Deref for Lease<'a, T> {
}
}
-impl<'a, T: 'static> core::ops::DerefMut for Lease<'a, T> {
+impl<T: 'static> core::ops::DerefMut for Lease<'_, T> {
fn deref_mut(&mut self) -> &mut Self::Target {
self.entity.as_mut().unwrap().downcast_mut().unwrap()
}
}
-impl<'a, T> Drop for Lease<'a, T> {
+impl<T> Drop for Lease<'_, T> {
fn drop(&mut self) {
if self.entity.is_some() && !panicking() {
panic!("Leases must be ended with EntityMap::end_lease")
@@ -82,7 +82,7 @@ impl From<Rgba> for u32 {
struct RgbaVisitor;
-impl<'de> Visitor<'de> for RgbaVisitor {
+impl Visitor<'_> for RgbaVisitor {
type Value = Rgba;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
@@ -180,7 +180,7 @@ impl TryFrom<&'_ str> for Rgba {
/// Duplicates a given hex digit.
/// E.g., `0xf` -> `0xff`.
const fn duplicate(value: u8) -> u8 {
- value << 4 | value
+ (value << 4) | value
}
(duplicate(r), duplicate(g), duplicate(b), duplicate(a))
@@ -946,13 +946,13 @@ impl<'a> sum_tree::Dimension<'a, ListItemSummary> for Height {
}
}
-impl<'a> sum_tree::SeekTarget<'a, ListItemSummary, ListItemSummary> for Count {
+impl sum_tree::SeekTarget<'_, ListItemSummary, ListItemSummary> for Count {
fn cmp(&self, other: &ListItemSummary, _: &()) -> std::cmp::Ordering {
self.0.partial_cmp(&other.count).unwrap()
}
}
-impl<'a> sum_tree::SeekTarget<'a, ListItemSummary, ListItemSummary> for Height {
+impl sum_tree::SeekTarget<'_, ListItemSummary, ListItemSummary> for Height {
fn cmp(&self, other: &ListItemSummary, _: &()) -> std::cmp::Ordering {
self.0.partial_cmp(&other.height).unwrap()
}
@@ -587,7 +587,7 @@ impl<'a> Scope<'a> {
}
}
-impl<'a> Drop for Scope<'a> {
+impl Drop for Scope<'_> {
fn drop(&mut self) {
self.tx.take().unwrap();
@@ -5,7 +5,6 @@ use objc::{class, msg_send, sel, sel_impl};
/// The `cocoa` crate does not define NSAttributedString (and related Cocoa classes),
/// which are needed for copying rich text (that is, text intermingled with images)
/// to the clipboard. This adds access to those APIs.
-
#[allow(non_snake_case)]
pub trait NSAttributedString: Sized {
unsafe fn alloc(_: Self) -> id {
@@ -26,7 +26,7 @@ pub(crate) mod dispatch_sys {
use dispatch_sys::*;
pub(crate) fn dispatch_get_main_queue() -> dispatch_queue_t {
- unsafe { addr_of!(_dispatch_main_q) as *const _ as dispatch_queue_t }
+ addr_of!(_dispatch_main_q) as *const _ as dispatch_queue_t
}
pub(crate) struct MacDispatcher {
@@ -1221,10 +1221,10 @@ fn set_window_composition_attribute(hwnd: HWND, color: Option<Color>, state: u32
unsafe {
type SetWindowCompositionAttributeType =
unsafe extern "system" fn(HWND, *mut WINDOWCOMPOSITIONATTRIBDATA) -> BOOL;
- let module_name = PCSTR::from_raw("user32.dll\0".as_ptr());
+ let module_name = PCSTR::from_raw(c"user32.dll".as_ptr() as *const u8);
let user32 = GetModuleHandleA(module_name);
if user32.is_ok() {
- let func_name = PCSTR::from_raw("SetWindowCompositionAttribute\0".as_ptr());
+ let func_name = PCSTR::from_raw(c"SetWindowCompositionAttribute".as_ptr() as *const u8);
let set_window_composition_attribute: SetWindowCompositionAttributeType =
std::mem::transmute(GetProcAddress(user32.unwrap(), func_name));
let mut color = color.unwrap_or_default();
@@ -1238,7 +1238,7 @@ fn set_window_composition_attribute(hwnd: HWND, color: Option<Color>, state: u32
gradient_color: (color.0 as u32)
| ((color.1 as u32) << 8)
| ((color.2 as u32) << 16)
- | (color.3 as u32) << 24,
+ | ((color.3 as u32) << 24),
animation_id: 0,
};
let mut data = WINDOWCOMPOSITIONATTRIBDATA {
@@ -670,6 +670,15 @@ pub struct TextRun {
pub strikethrough: Option<StrikethroughStyle>,
}
+#[cfg(all(target_os = "macos", test))]
+impl TextRun {
+ fn with_len(&self, len: usize) -> Self {
+ let mut this = self.clone();
+ this.len = len;
+ this
+ }
+}
+
/// An identifier for a specific glyph, as returned by [`TextSystem::layout_line`].
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
#[repr(C)]
@@ -601,15 +601,15 @@ struct CacheKeyRef<'a> {
wrap_width: Option<Pixels>,
}
-impl<'a> PartialEq for (dyn AsCacheKeyRef + 'a) {
+impl PartialEq for (dyn AsCacheKeyRef + '_) {
fn eq(&self, other: &dyn AsCacheKeyRef) -> bool {
self.as_cache_key_ref() == other.as_cache_key_ref()
}
}
-impl<'a> Eq for (dyn AsCacheKeyRef + 'a) {}
+impl Eq for (dyn AsCacheKeyRef + '_) {}
-impl<'a> Hash for (dyn AsCacheKeyRef + 'a) {
+impl Hash for (dyn AsCacheKeyRef + '_) {
fn hash<H: Hasher>(&self, state: &mut H) {
self.as_cache_key_ref().hash(state)
}
@@ -644,7 +644,7 @@ impl<'a> Borrow<dyn AsCacheKeyRef + 'a> for Arc<CacheKey> {
}
}
-impl<'a> AsCacheKeyRef for CacheKeyRef<'a> {
+impl AsCacheKeyRef for CacheKeyRef<'_> {
fn as_cache_key_ref(&self) -> CacheKeyRef {
*self
}
@@ -543,14 +543,6 @@ mod tests {
background_color: None,
};
- impl TextRun {
- fn with_len(&self, len: usize) -> Self {
- let mut this = self.clone();
- this.len = len;
- this
- }
- }
-
let text = "aa bbb cccc ddddd eeee".into();
let lines = text_system
.shape_text(
@@ -72,7 +72,7 @@ where
pub struct CwdBacktrace<'a>(pub &'a backtrace::Backtrace);
#[cfg(any(test, feature = "test-support"))]
-impl<'a> std::fmt::Debug for CwdBacktrace<'a> {
+impl std::fmt::Debug for CwdBacktrace<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
use backtrace::{BacktraceFmt, BytesOrWideString};
@@ -3689,8 +3689,6 @@ impl Window {
dispatch_tree.bindings_for_action(action, &[context])
}
- /// Returns a generic event listener that invokes the given listener with the view and context associated with the given view handle.
-
/// Returns a generic event listener that invokes the given listener with the view and context associated with the given view handle.
pub fn listener_for<V: Render, E>(
&self,
@@ -79,7 +79,7 @@ pub trait HttpClient: 'static + Send + Sync {
.body(body);
match request {
- Ok(request) => Box::pin(async move { self.send(request).await.map_err(Into::into) }),
+ Ok(request) => Box::pin(async move { self.send(request).await }),
Err(e) => Box::pin(async move { Err(e.into()) }),
}
}
@@ -96,7 +96,7 @@ pub trait HttpClient: 'static + Send + Sync {
.body(body);
match request {
- Ok(request) => Box::pin(async move { self.send(request).await.map_err(Into::into) }),
+ Ok(request) => Box::pin(async move { self.send(request).await }),
Err(e) => Box::pin(async move { Err(e.into()) }),
}
}
@@ -509,7 +509,7 @@ impl fmt::Debug for ChunkRenderer {
}
}
-impl<'a, 'b> Deref for ChunkRendererContext<'a, 'b> {
+impl Deref for ChunkRendererContext<'_, '_> {
type Target = App;
fn deref(&self) -> &Self::Target {
@@ -517,7 +517,7 @@ impl<'a, 'b> Deref for ChunkRendererContext<'a, 'b> {
}
}
-impl<'a, 'b> DerefMut for ChunkRendererContext<'a, 'b> {
+impl DerefMut for ChunkRendererContext<'_, '_> {
fn deref_mut(&mut self) -> &mut Self::Target {
self.context
}
@@ -4137,7 +4137,7 @@ impl Deref for BufferSnapshot {
}
}
-unsafe impl<'a> Send for BufferChunks<'a> {}
+unsafe impl Send for BufferChunks<'_> {}
impl<'a> BufferChunks<'a> {
pub(crate) fn new(
@@ -836,7 +836,7 @@ impl SyntaxSnapshot {
}
#[cfg(test)]
- pub fn layers<'a>(&'a self, buffer: &'a BufferSnapshot) -> Vec<SyntaxLayer> {
+ pub fn layers<'a>(&'a self, buffer: &'a BufferSnapshot) -> Vec<SyntaxLayer<'a>> {
self.layers_for_range(0..buffer.len(), buffer, true)
.collect()
}
@@ -1142,7 +1142,7 @@ impl<'a> SyntaxMapMatches<'a> {
}
}
-impl<'a> SyntaxMapCapturesLayer<'a> {
+impl SyntaxMapCapturesLayer<'_> {
fn advance(&mut self) {
self.next_capture = self.captures.next().map(|(mat, ix)| mat.captures[*ix]);
}
@@ -1157,7 +1157,7 @@ impl<'a> SyntaxMapCapturesLayer<'a> {
}
}
-impl<'a> SyntaxMapMatchesLayer<'a> {
+impl SyntaxMapMatchesLayer<'_> {
fn advance(&mut self) {
if let Some(mat) = self.matches.next() {
self.next_captures.clear();
@@ -1740,7 +1740,7 @@ impl sum_tree::Summary for SyntaxLayerSummary {
}
}
-impl<'a> SeekTarget<'a, SyntaxLayerSummary, SyntaxLayerSummary> for SyntaxLayerPosition {
+impl SeekTarget<'_, SyntaxLayerSummary, SyntaxLayerSummary> for SyntaxLayerPosition {
fn cmp(&self, cursor_location: &SyntaxLayerSummary, buffer: &BufferSnapshot) -> Ordering {
Ord::cmp(&self.depth, &cursor_location.max_depth)
.then_with(|| {
@@ -1758,16 +1758,14 @@ impl<'a> SeekTarget<'a, SyntaxLayerSummary, SyntaxLayerSummary> for SyntaxLayerP
}
}
-impl<'a> SeekTarget<'a, SyntaxLayerSummary, SyntaxLayerSummary> for ChangeStartPosition {
+impl SeekTarget<'_, SyntaxLayerSummary, SyntaxLayerSummary> for ChangeStartPosition {
fn cmp(&self, cursor_location: &SyntaxLayerSummary, text: &BufferSnapshot) -> Ordering {
Ord::cmp(&self.depth, &cursor_location.max_depth)
.then_with(|| self.position.cmp(&cursor_location.range.end, text))
}
}
-impl<'a> SeekTarget<'a, SyntaxLayerSummary, SyntaxLayerSummary>
- for SyntaxLayerPositionBeforeChange
-{
+impl SeekTarget<'_, SyntaxLayerSummary, SyntaxLayerSummary> for SyntaxLayerPositionBeforeChange {
fn cmp(&self, cursor_location: &SyntaxLayerSummary, buffer: &BufferSnapshot) -> Ordering {
if self.change.cmp(cursor_location, buffer).is_le() {
Ordering::Less
@@ -1869,7 +1867,7 @@ struct LogPoint(Point);
struct LogAnchorRange<'a>(&'a Range<Anchor>, &'a text::BufferSnapshot);
struct LogChangedRegions<'a>(&'a ChangeRegionSet, &'a text::BufferSnapshot);
-impl<'a> fmt::Debug for LogIncludedRanges<'a> {
+impl fmt::Debug for LogIncludedRanges<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list()
.entries(self.0.iter().map(|range| {
@@ -1881,14 +1879,14 @@ impl<'a> fmt::Debug for LogIncludedRanges<'a> {
}
}
-impl<'a> fmt::Debug for LogAnchorRange<'a> {
+impl fmt::Debug for LogAnchorRange<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let range = self.0.to_point(self.1);
(LogPoint(range.start)..LogPoint(range.end)).fmt(f)
}
}
-impl<'a> fmt::Debug for LogChangedRegions<'a> {
+impl fmt::Debug for LogChangedRegions<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list()
.entries(
@@ -305,13 +305,7 @@ impl LspAdapter for ExtensionLspAdapter {
.labels_for_symbols(self.language_server_id.clone(), symbols)
.await?;
- Ok(labels_from_extension(
- labels
- .into_iter()
- .map(|label| label.map(Into::into))
- .collect(),
- language,
- ))
+ Ok(labels_from_extension(labels, language))
}
}
@@ -153,8 +153,8 @@ impl LlmApiToken {
Self::fetch(self.0.write().await, client).await
}
- async fn fetch<'a>(
- mut lock: RwLockWriteGuard<'a, Option<String>>,
+ async fn fetch(
+ mut lock: RwLockWriteGuard<'_, Option<String>>,
client: &Arc<Client>,
) -> Result<String> {
let response = client.request(proto::GetLlmToken {}).await?;
@@ -684,7 +684,7 @@ impl<'a> EnvironmentApi<'a> {
}
}
-impl<'a> pet_core::os_environment::Environment for EnvironmentApi<'a> {
+impl pet_core::os_environment::Environment for EnvironmentApi<'_> {
fn get_user_home(&self) -> Option<PathBuf> {
self.user_home()
}
@@ -6896,7 +6896,7 @@ impl<'a> sum_tree::Dimension<'a, ExcerptSummary> for ExcerptOffset {
}
}
-impl<'a> sum_tree::SeekTarget<'a, ExcerptSummary, ExcerptSummary> for ExcerptOffset {
+impl sum_tree::SeekTarget<'_, ExcerptSummary, ExcerptSummary> for ExcerptOffset {
fn cmp(&self, cursor_location: &ExcerptSummary, _: &()) -> cmp::Ordering {
Ord::cmp(&self.value, &cursor_location.text.len)
}
@@ -6908,7 +6908,7 @@ impl<'a> sum_tree::SeekTarget<'a, ExcerptSummary, Option<&'a Locator>> for Locat
}
}
-impl<'a> sum_tree::SeekTarget<'a, ExcerptSummary, ExcerptSummary> for Locator {
+impl sum_tree::SeekTarget<'_, ExcerptSummary, ExcerptSummary> for Locator {
fn cmp(&self, cursor_location: &ExcerptSummary, _: &()) -> cmp::Ordering {
Ord::cmp(self, &cursor_location.excerpt_locator)
}
@@ -6982,16 +6982,16 @@ impl<'a> sum_tree::Dimension<'a, DiffTransformSummary> for ExcerptPoint {
}
}
-impl<'a, D: TextDimension + Ord>
- sum_tree::SeekTarget<'a, DiffTransformSummary, DiffTransformSummary> for ExcerptDimension<D>
+impl<D: TextDimension + Ord> sum_tree::SeekTarget<'_, DiffTransformSummary, DiffTransformSummary>
+ for ExcerptDimension<D>
{
fn cmp(&self, cursor_location: &DiffTransformSummary, _: &()) -> cmp::Ordering {
Ord::cmp(&self.0, &D::from_text_summary(&cursor_location.input))
}
}
-impl<'a, D: TextDimension + Ord>
- sum_tree::SeekTarget<'a, DiffTransformSummary, (OutputDimension<D>, ExcerptDimension<D>)>
+impl<D: TextDimension + Ord>
+ sum_tree::SeekTarget<'_, DiffTransformSummary, (OutputDimension<D>, ExcerptDimension<D>)>
for ExcerptDimension<D>
{
fn cmp(
@@ -7053,14 +7053,14 @@ impl<'a> sum_tree::Dimension<'a, DiffTransformSummary> for Point {
}
}
-impl<'a> MultiBufferRows<'a> {
+impl MultiBufferRows<'_> {
pub fn seek(&mut self, MultiBufferRow(row): MultiBufferRow) {
self.point = Point::new(row, 0);
self.cursor.seek(&self.point);
}
}
-impl<'a> Iterator for MultiBufferRows<'a> {
+impl Iterator for MultiBufferRows<'_> {
type Item = RowInfo;
fn next(&mut self) -> Option<Self::Item> {
@@ -7304,7 +7304,7 @@ impl<'a> Iterator for MultiBufferChunks<'a> {
}
}
-impl<'a> MultiBufferBytes<'a> {
+impl MultiBufferBytes<'_> {
fn consume(&mut self, len: usize) {
self.range.start += len;
self.chunk = &self.chunk[len..];
@@ -7351,7 +7351,7 @@ impl<'a> Iterator for MultiBufferBytes<'a> {
}
}
-impl<'a> io::Read for MultiBufferBytes<'a> {
+impl io::Read for MultiBufferBytes<'_> {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
let len = cmp::min(buf.len(), self.chunk.len());
buf[..len].copy_from_slice(&self.chunk[..len]);
@@ -7362,7 +7362,7 @@ impl<'a> io::Read for MultiBufferBytes<'a> {
}
}
-impl<'a> io::Read for ReversedMultiBufferBytes<'a> {
+impl io::Read for ReversedMultiBufferBytes<'_> {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
let len = cmp::min(buf.len(), self.chunk.len());
buf[..len].copy_from_slice(&self.chunk[..len]);
@@ -469,7 +469,7 @@ impl sum_tree::Summary for NotificationSummary {
}
}
-impl<'a> sum_tree::Dimension<'a, NotificationSummary> for NotificationId {
+impl sum_tree::Dimension<'_, NotificationSummary> for NotificationId {
fn zero(_cx: &()) -> Self {
Default::default()
}
@@ -480,7 +480,7 @@ impl<'a> sum_tree::Dimension<'a, NotificationSummary> for NotificationId {
}
}
-impl<'a> sum_tree::Dimension<'a, NotificationSummary> for Count {
+impl sum_tree::Dimension<'_, NotificationSummary> for Count {
fn zero(_cx: &()) -> Self {
Default::default()
}
@@ -1632,9 +1632,9 @@ impl BufferStore {
// file in the Cargo registry (presumably opened with go-to-definition
// from a normal Rust file). If so, we can put together a permalink
// using crate metadata.
- if !buffer
+ if buffer
.language()
- .is_some_and(|lang| lang.name() == "Rust".into())
+ .is_none_or(|lang| lang.name() != "Rust".into())
{
return Task::ready(Err(anyhow!("no permalink available")));
}
@@ -78,7 +78,7 @@ pub struct ChunkSlice<'a> {
text: &'a str,
}
-impl<'a> Into<Chunk> for ChunkSlice<'a> {
+impl Into<Chunk> for ChunkSlice<'_> {
fn into(self) -> Chunk {
Chunk {
chars: self.chars,
@@ -124,8 +124,8 @@ impl PartialOrd for Point {
impl Ord for Point {
#[cfg(target_pointer_width = "64")]
fn cmp(&self, other: &Point) -> Ordering {
- let a = (self.row as usize) << 32 | self.column as usize;
- let b = (other.row as usize) << 32 | other.column as usize;
+ let a = ((self.row as usize) << 32) | self.column as usize;
+ let b = ((other.row as usize) << 32) | other.column as usize;
a.cmp(&b)
}
@@ -104,8 +104,8 @@ impl PartialOrd for PointUtf16 {
impl Ord for PointUtf16 {
#[cfg(target_pointer_width = "64")]
fn cmp(&self, other: &PointUtf16) -> Ordering {
- let a = (self.row as usize) << 32 | self.column as usize;
- let b = (other.row as usize) << 32 | other.column as usize;
+ let a = ((self.row as usize) << 32) | self.column as usize;
+ let b = ((other.row as usize) << 32) | other.column as usize;
a.cmp(&b)
}
@@ -145,7 +145,7 @@ impl Rope {
// We also round up the capacity up by one, for a good measure; we *really* don't want to realloc here, as we assume that the # of characters
// we're working with there is large.
- let capacity = (text.len() + MIN_CHUNK_SIZE - 1) / MIN_CHUNK_SIZE;
+ let capacity = text.len().div_ceil(MIN_CHUNK_SIZE);
let mut new_chunks = Vec::with_capacity(capacity);
while !text.is_empty() {
@@ -855,7 +855,7 @@ impl<'a> Iterator for Bytes<'a> {
}
}
-impl<'a> io::Read for Bytes<'a> {
+impl io::Read for Bytes<'_> {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
if let Some(chunk) = self.peek() {
let len = cmp::min(buf.len(), chunk.len());
@@ -889,7 +889,7 @@ pub struct Lines<'a> {
reversed: bool,
}
-impl<'a> Lines<'a> {
+impl Lines<'_> {
pub fn next(&mut self) -> Option<&str> {
if self.done {
return None;
@@ -1909,7 +1909,7 @@ mod tests {
.unindent();
let expected_query_matches_count = buffer_text
.chars()
- .filter(|c| c.to_ascii_lowercase() == 'a')
+ .filter(|c| c.eq_ignore_ascii_case(&'a'))
.count();
assert!(
expected_query_matches_count > 1,
@@ -8,7 +8,7 @@ pub struct SettingsJsonSchemaParams<'a> {
pub font_names: &'a [String],
}
-impl<'a> SettingsJsonSchemaParams<'a> {
+impl SettingsJsonSchemaParams<'_> {
pub fn font_family_schema(&self) -> Schema {
let available_fonts: Vec<_> = self.font_names.iter().cloned().map(Value::String).collect();
@@ -377,7 +377,7 @@ impl<'a> Statement<'a> {
}
}
-impl<'a> Drop for Statement<'a> {
+impl Drop for Statement<'_> {
fn drop(&mut self) {
unsafe {
for raw_statement in self.raw_statements.iter() {
@@ -9,7 +9,7 @@ struct StackEntry<'a, T: Item, D> {
position: D,
}
-impl<'a, T: Item + fmt::Debug, D: fmt::Debug> fmt::Debug for StackEntry<'a, T, D> {
+impl<T: Item + fmt::Debug, D: fmt::Debug> fmt::Debug for StackEntry<'_, T, D> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("StackEntry")
.field("index", &self.index)
@@ -27,7 +27,7 @@ pub struct Cursor<'a, T: Item, D> {
at_end: bool,
}
-impl<'a, T: Item + fmt::Debug, D: fmt::Debug> fmt::Debug for Cursor<'a, T, D>
+impl<T: Item + fmt::Debug, D: fmt::Debug> fmt::Debug for Cursor<'_, T, D>
where
T::Summary: fmt::Debug,
{
@@ -742,14 +742,14 @@ struct SliceSeekAggregate<T: Item> {
struct SummarySeekAggregate<D>(D);
-impl<'a, T: Item> SeekAggregate<'a, T> for () {
+impl<T: Item> SeekAggregate<'_, T> for () {
fn begin_leaf(&mut self) {}
fn end_leaf(&mut self, _: &<T::Summary as Summary>::Context) {}
fn push_item(&mut self, _: &T, _: &T::Summary, _: &<T::Summary as Summary>::Context) {}
fn push_tree(&mut self, _: &SumTree<T>, _: &T::Summary, _: &<T::Summary as Summary>::Context) {}
}
-impl<'a, T: Item> SeekAggregate<'a, T> for SliceSeekAggregate<T> {
+impl<T: Item> SeekAggregate<'_, T> for SliceSeekAggregate<T> {
fn begin_leaf(&mut self) {}
fn end_leaf(&mut self, cx: &<T::Summary as Summary>::Context) {
self.tree.append(
@@ -1468,7 +1468,7 @@ mod tests {
}
}
- impl<'a> Dimension<'a, IntegersSummary> for u8 {
+ impl Dimension<'_, IntegersSummary> for u8 {
fn zero(_cx: &()) -> Self {
Default::default()
}
@@ -1478,7 +1478,7 @@ mod tests {
}
}
- impl<'a> Dimension<'a, IntegersSummary> for Count {
+ impl Dimension<'_, IntegersSummary> for Count {
fn zero(_cx: &()) -> Self {
Default::default()
}
@@ -1488,13 +1488,13 @@ mod tests {
}
}
- impl<'a> SeekTarget<'a, IntegersSummary, IntegersSummary> for Count {
+ impl SeekTarget<'_, IntegersSummary, IntegersSummary> for Count {
fn cmp(&self, cursor_location: &IntegersSummary, _: &()) -> Ordering {
self.0.cmp(&cursor_location.count)
}
}
- impl<'a> Dimension<'a, IntegersSummary> for Sum {
+ impl Dimension<'_, IntegersSummary> for Sum {
fn zero(_cx: &()) -> Self {
Default::default()
}
@@ -26,7 +26,7 @@ impl<K> Default for MapKey<K> {
#[derive(Clone, Debug)]
pub struct MapKeyRef<'a, K>(Option<&'a K>);
-impl<'a, K> Default for MapKeyRef<'a, K> {
+impl<K> Default for MapKeyRef<'_, K> {
fn default() -> Self {
Self(None)
}
@@ -123,10 +123,7 @@ impl PtyProcessInfo {
fn load(&mut self) -> Option<ProcessInfo> {
let process = self.refresh()?;
- let cwd = process
- .cwd()
- .take()
- .map_or(PathBuf::new(), |p| p.to_owned());
+ let cwd = process.cwd().map_or(PathBuf::new(), |p| p.to_owned());
let info = ProcessInfo {
name: process.name().to_str()?.to_owned(),
@@ -81,7 +81,7 @@ impl Summary for OperationSummary {
}
}
-impl<'a> Add<&'a Self> for OperationSummary {
+impl Add<&Self> for OperationSummary {
type Output = Self;
fn add(self, other: &Self) -> Self {
@@ -93,7 +93,7 @@ impl<'a> Add<&'a Self> for OperationSummary {
}
}
-impl<'a> Dimension<'a, OperationSummary> for OperationKey {
+impl Dimension<'_, OperationSummary> for OperationKey {
fn zero(_cx: &()) -> Self {
Default::default()
}
@@ -2533,7 +2533,7 @@ impl<'a> RopeBuilder<'a> {
}
}
-impl<'a, D: TextDimension + Ord, F: FnMut(&FragmentSummary) -> bool> Iterator for Edits<'a, D, F> {
+impl<D: TextDimension + Ord, F: FnMut(&FragmentSummary) -> bool> Iterator for Edits<'_, D, F> {
type Item = (Edit<D>, Range<Anchor>);
fn next(&mut self) -> Option<Self::Item> {
@@ -2801,7 +2801,7 @@ impl ops::Sub for FullOffset {
}
}
-impl<'a> sum_tree::Dimension<'a, FragmentSummary> for usize {
+impl sum_tree::Dimension<'_, FragmentSummary> for usize {
fn zero(_: &Option<clock::Global>) -> Self {
Default::default()
}
@@ -2811,7 +2811,7 @@ impl<'a> sum_tree::Dimension<'a, FragmentSummary> for usize {
}
}
-impl<'a> sum_tree::Dimension<'a, FragmentSummary> for FullOffset {
+impl sum_tree::Dimension<'_, FragmentSummary> for FullOffset {
fn zero(_: &Option<clock::Global>) -> Self {
Default::default()
}
@@ -2831,7 +2831,7 @@ impl<'a> sum_tree::Dimension<'a, FragmentSummary> for Option<&'a Locator> {
}
}
-impl<'a> sum_tree::SeekTarget<'a, FragmentSummary, FragmentTextSummary> for usize {
+impl sum_tree::SeekTarget<'_, FragmentSummary, FragmentTextSummary> for usize {
fn cmp(
&self,
cursor_location: &FragmentTextSummary,
@@ -2880,7 +2880,7 @@ impl<'a> sum_tree::Dimension<'a, FragmentSummary> for VersionedFullOffset {
}
}
-impl<'a> sum_tree::SeekTarget<'a, FragmentSummary, Self> for VersionedFullOffset {
+impl sum_tree::SeekTarget<'_, FragmentSummary, Self> for VersionedFullOffset {
fn cmp(&self, cursor_position: &Self, _: &Option<clock::Global>) -> cmp::Ordering {
match (self, cursor_position) {
(Self::Offset(a), Self::Offset(b)) => Ord::cmp(a, b),
@@ -2952,7 +2952,7 @@ impl ToOffset for Anchor {
}
}
-impl<'a, T: ToOffset> ToOffset for &'a T {
+impl<T: ToOffset> ToOffset for &T {
fn to_offset(&self, content: &BufferSnapshot) -> usize {
(*self).to_offset(content)
}
@@ -11,7 +11,7 @@ pub enum ArcCow<'a, T: ?Sized> {
Owned(Arc<T>),
}
-impl<'a, T: ?Sized + PartialEq> PartialEq for ArcCow<'a, T> {
+impl<T: ?Sized + PartialEq> PartialEq for ArcCow<'_, T> {
fn eq(&self, other: &Self) -> bool {
let a = self.as_ref();
let b = other.as_ref();
@@ -19,21 +19,21 @@ impl<'a, T: ?Sized + PartialEq> PartialEq for ArcCow<'a, T> {
}
}
-impl<'a, T: ?Sized + PartialOrd> PartialOrd for ArcCow<'a, T> {
+impl<T: ?Sized + PartialOrd> PartialOrd for ArcCow<'_, T> {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
self.as_ref().partial_cmp(other.as_ref())
}
}
-impl<'a, T: ?Sized + Ord> Ord for ArcCow<'a, T> {
+impl<T: ?Sized + Ord> Ord for ArcCow<'_, T> {
fn cmp(&self, other: &Self) -> Ordering {
self.as_ref().cmp(other.as_ref())
}
}
-impl<'a, T: ?Sized + Eq> Eq for ArcCow<'a, T> {}
+impl<T: ?Sized + Eq> Eq for ArcCow<'_, T> {}
-impl<'a, T: ?Sized + Hash> Hash for ArcCow<'a, T> {
+impl<T: ?Sized + Hash> Hash for ArcCow<'_, T> {
fn hash<H: Hasher>(&self, state: &mut H) {
match self {
Self::Borrowed(borrowed) => Hash::hash(borrowed, state),
@@ -42,7 +42,7 @@ impl<'a, T: ?Sized + Hash> Hash for ArcCow<'a, T> {
}
}
-impl<'a, T: ?Sized> Clone for ArcCow<'a, T> {
+impl<T: ?Sized> Clone for ArcCow<'_, T> {
fn clone(&self) -> Self {
match self {
Self::Borrowed(borrowed) => Self::Borrowed(borrowed),
@@ -102,7 +102,7 @@ impl<'a> From<&'a str> for ArcCow<'a, [u8]> {
}
}
-impl<'a, T: ?Sized + ToOwned> std::borrow::Borrow<T> for ArcCow<'a, T> {
+impl<T: ?Sized + ToOwned> std::borrow::Borrow<T> for ArcCow<'_, T> {
fn borrow(&self) -> &T {
match self {
ArcCow::Borrowed(borrowed) => borrowed,
@@ -131,7 +131,7 @@ impl<T: ?Sized> AsRef<T> for ArcCow<'_, T> {
}
}
-impl<'a, T: ?Sized + Debug> Debug for ArcCow<'a, T> {
+impl<T: ?Sized + Debug> Debug for ArcCow<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
ArcCow::Borrowed(borrowed) => Debug::fmt(borrowed, f),
@@ -781,7 +781,7 @@ impl Ord for NumericPrefixWithSuffix<'_> {
}
}
-impl<'a> PartialOrd for NumericPrefixWithSuffix<'a> {
+impl PartialOrd for NumericPrefixWithSuffix<'_> {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
@@ -1498,9 +1498,7 @@ impl LocalWorktree {
};
scanner
- .run(Box::pin(
- events.map(|events| events.into_iter().map(Into::into).collect()),
- ))
+ .run(Box::pin(events.map(|events| events.into_iter().collect())))
.await;
}
});
@@ -3630,7 +3628,7 @@ impl fmt::Debug for Snapshot {
struct EntriesById<'a>(&'a SumTree<PathEntry>);
struct EntriesByPath<'a>(&'a SumTree<Entry>);
- impl<'a> fmt::Debug for EntriesByPath<'a> {
+ impl fmt::Debug for EntriesByPath<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_map()
.entries(self.0.iter().map(|entry| (&entry.path, entry.id)))
@@ -3638,7 +3636,7 @@ impl fmt::Debug for Snapshot {
}
}
- impl<'a> fmt::Debug for EntriesById<'a> {
+ impl fmt::Debug for EntriesById<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list().entries(self.0.iter()).finish()
}
@@ -5922,7 +5920,7 @@ struct TraversalProgress<'a> {
non_ignored_file_count: usize,
}
-impl<'a> TraversalProgress<'a> {
+impl TraversalProgress<'_> {
fn count(&self, include_files: bool, include_dirs: bool, include_ignored: bool) -> usize {
match (include_files, include_dirs, include_ignored) {
(true, true, true) => self.count,
@@ -5950,7 +5948,7 @@ impl<'a> sum_tree::Dimension<'a, EntrySummary> for TraversalProgress<'a> {
}
}
-impl<'a> Default for TraversalProgress<'a> {
+impl Default for TraversalProgress<'_> {
fn default() -> Self {
Self {
max_path: Path::new(""),
@@ -5968,7 +5966,7 @@ pub struct GitEntryRef<'a> {
pub git_summary: GitSummary,
}
-impl<'a> GitEntryRef<'a> {
+impl GitEntryRef<'_> {
pub fn to_owned(&self) -> GitEntry {
GitEntry {
entry: self.entry.clone(),
@@ -5977,7 +5975,7 @@ impl<'a> GitEntryRef<'a> {
}
}
-impl<'a> Deref for GitEntryRef<'a> {
+impl Deref for GitEntryRef<'_> {
type Target = Entry;
fn deref(&self) -> &Self::Target {
@@ -5985,7 +5983,7 @@ impl<'a> Deref for GitEntryRef<'a> {
}
}
-impl<'a> AsRef<Entry> for GitEntryRef<'a> {
+impl AsRef<Entry> for GitEntryRef<'_> {
fn as_ref(&self) -> &Entry {
self.entry
}
@@ -6246,7 +6244,7 @@ enum PathTarget<'a> {
Successor(&'a Path),
}
-impl<'a> PathTarget<'a> {
+impl PathTarget<'_> {
fn cmp_path(&self, other: &Path) -> Ordering {
match self {
PathTarget::Path(path) => path.cmp(&other),
@@ -6261,20 +6259,20 @@ impl<'a> PathTarget<'a> {
}
}
-impl<'a, 'b, S: Summary> SeekTarget<'a, PathSummary<S>, PathProgress<'a>> for PathTarget<'b> {
+impl<'a, S: Summary> SeekTarget<'a, PathSummary<S>, PathProgress<'a>> for PathTarget<'_> {
fn cmp(&self, cursor_location: &PathProgress<'a>, _: &S::Context) -> Ordering {
self.cmp_path(&cursor_location.max_path)
}
}
-impl<'a, 'b, S: Summary> SeekTarget<'a, PathSummary<S>, TraversalProgress<'a>> for PathTarget<'b> {
+impl<'a, S: Summary> SeekTarget<'a, PathSummary<S>, TraversalProgress<'a>> for PathTarget<'_> {
fn cmp(&self, cursor_location: &TraversalProgress<'a>, _: &S::Context) -> Ordering {
self.cmp_path(&cursor_location.max_path)
}
}
-impl<'a, 'b> SeekTarget<'a, PathSummary<GitSummary>, (TraversalProgress<'a>, GitSummary)>
- for PathTarget<'b>
+impl<'a> SeekTarget<'a, PathSummary<GitSummary>, (TraversalProgress<'a>, GitSummary)>
+ for PathTarget<'_>
{
fn cmp(&self, cursor_location: &(TraversalProgress<'a>, GitSummary), _: &()) -> Ordering {
self.cmp_path(&cursor_location.0.max_path)
@@ -6317,13 +6315,13 @@ impl<'a> TraversalTarget<'a> {
}
}
-impl<'a, 'b> SeekTarget<'a, EntrySummary, TraversalProgress<'a>> for TraversalTarget<'b> {
+impl<'a> SeekTarget<'a, EntrySummary, TraversalProgress<'a>> for TraversalTarget<'_> {
fn cmp(&self, cursor_location: &TraversalProgress<'a>, _: &()) -> Ordering {
self.cmp_progress(cursor_location)
}
}
-impl<'a, 'b> SeekTarget<'a, PathSummary<Unit>, TraversalProgress<'a>> for TraversalTarget<'b> {
+impl<'a> SeekTarget<'a, PathSummary<Unit>, TraversalProgress<'a>> for TraversalTarget<'_> {
fn cmp(&self, cursor_location: &TraversalProgress<'a>, _: &()) -> Ordering {
self.cmp_progress(cursor_location)
}
@@ -1,5 +1,5 @@
[toolchain]
-channel = "1.81"
+channel = "1.85"
profile = "minimal"
components = [ "rustfmt", "clippy" ]
targets = [ "x86_64-apple-darwin", "aarch64-apple-darwin", "x86_64-unknown-linux-gnu", "wasm32-wasip1", "x86_64-pc-windows-msvc" ]