Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Upgrade to Rust 1.83.0 #9652

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/turborepo-filewatch/src/optional_watch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl<T> OptionalWatch<T> {

pub struct SomeRef<'a, T>(pub(crate) Ref<'a, Option<T>>);

impl<'a, T> std::ops::Deref for SomeRef<'a, T> {
impl<T> std::ops::Deref for SomeRef<'_, T> {
type Target = T;

fn deref(&self) -> &Self::Target {
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-filewatch/src/scm_resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl SCMResource {
}
}

impl<'a> Deref for SCMPermit<'a> {
impl Deref for SCMPermit<'_> {
type Target = SCM;

fn deref(&self) -> &Self::Target {
Expand Down
3 changes: 2 additions & 1 deletion crates/turborepo-lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
#![feature(box_patterns)]
#![feature(error_generic_member_access)]
#![feature(hash_extract_if)]
#![feature(option_get_or_insert_default)]
#![feature(once_cell_try)]
#![feature(try_blocks)]
#![feature(impl_trait_in_assoc_type)]
#![deny(clippy::all)]
// Clippy's needless mut lint is buggy: https://github.com/rust-lang/rust-clippy/issues/11299
#![allow(clippy::needless_pass_by_ref_mut)]
// Code generated by tonic-build don't follow this lint
#![allow(clippy::needless_lifetimes)]
#![allow(dead_code)]

mod child;
Expand Down
1 change: 0 additions & 1 deletion crates/turborepo-lib/src/task_graph/visitor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,6 @@ impl<'a> Visitor<'a> {

/// Finishes visiting the tasks, creates the run summary, and either
/// prints, saves, or sends it to spaces.

#[allow(clippy::too_many_arguments)]
#[tracing::instrument(skip(
self,
Expand Down
8 changes: 4 additions & 4 deletions crates/turborepo-lockfiles/src/berry/identifiers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub struct Locator<'a> {
pub reference: Cow<'a, str>,
}

impl<'a> Ident<'a> {
impl Ident<'_> {
/// Clones underlying strings and changes lifetime to represent this
pub fn to_owned(&self) -> Ident<'static> {
let Ident { scope, name } = self;
Expand All @@ -91,7 +91,7 @@ impl<'a> TryFrom<&'a str> for Ident<'a> {
}
}

impl<'a> fmt::Display for Ident<'a> {
impl fmt::Display for Ident<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> std::fmt::Result {
if let Some(scope) = self.scope.as_deref() {
f.write_fmt(format_args!("@{scope}/"))?;
Expand All @@ -114,7 +114,7 @@ impl<'a> TryFrom<&'a str> for Descriptor<'a> {
}
}

impl<'a> fmt::Display for Descriptor<'a> {
impl fmt::Display for Descriptor<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_fmt(format_args!("{}@{}", self.ident, self.range))
}
Expand Down Expand Up @@ -186,7 +186,7 @@ impl<'a> TryFrom<&'a str> for Locator<'a> {
}
}

impl<'a> fmt::Display for Locator<'a> {
impl fmt::Display for Locator<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_fmt(format_args!("{}@{}", self.ident, self.reference))
}
Expand Down
4 changes: 3 additions & 1 deletion crates/turborepo-microfrontends/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ impl Config {
})
}

pub fn development_tasks<'a>(&'a self) -> Box<dyn Iterator<Item = (&str, Option<&str>)> + 'a> {
pub fn development_tasks<'a>(
&'a self,
) -> Box<dyn Iterator<Item = (&'a str, Option<&'a str>)> + 'a> {
match &self.inner {
ConfigInner::V1(config_v1) => Box::new(config_v1.development_tasks()),
ConfigInner::V2(config_v2) => Box::new(config_v2.development_tasks()),
Expand Down
4 changes: 2 additions & 2 deletions crates/turborepo-repository/src/change_mapper/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl<'a> DefaultPackageChangeMapper<'a> {
}
}

impl<'a> PackageChangeMapper for DefaultPackageChangeMapper<'a> {
impl PackageChangeMapper for DefaultPackageChangeMapper<'_> {
fn detect_package(&self, file: &AnchoredSystemPath) -> PackageMapping {
for (name, entry) in self.pkg_dep_graph.packages() {
if name == &PackageName::Root {
Expand Down Expand Up @@ -105,7 +105,7 @@ impl<'a> GlobalDepsPackageChangeMapper<'a> {
}
}

impl<'a> PackageChangeMapper for GlobalDepsPackageChangeMapper<'a> {
impl PackageChangeMapper for GlobalDepsPackageChangeMapper<'_> {
fn detect_package(&self, path: &AnchoredSystemPath) -> PackageMapping {
// If we have a lockfile change, we consider this as a root package change,
// since there's a chance that the root package uses a workspace package
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-repository/src/package_graph/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ enum ResolvedWorkspaces {}
// Allows us to collect all transitive deps
enum ResolvedLockfile {}

impl<'a, S, T> BuildState<'a, S, T> {
impl<S, T> BuildState<'_, S, T> {
fn add_node(&mut self, node: PackageNode) -> NodeIndex {
let idx = self.workspace_graph.add_node(node.clone());
self.node_lookup.insert(node, idx);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ impl<'a> DependencyVersion<'a> {
}
}

impl<'a> fmt::Display for DependencyVersion<'a> {
impl fmt::Display for DependencyVersion<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.protocol {
Some(protocol) => f.write_fmt(format_args!("{}:{}", protocol, self.version)),
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-repository/src/package_manager/bun.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl<'a> BunDetector<'a> {
}
}

impl<'a> Iterator for BunDetector<'a> {
impl Iterator for BunDetector<'_> {
type Item = Result<PackageManager, Error>;

fn next(&mut self) -> Option<Self::Item> {
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-repository/src/package_manager/npm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl<'a> NpmDetector<'a> {
}
}

impl<'a> Iterator for NpmDetector<'a> {
impl Iterator for NpmDetector<'_> {
type Item = Result<PackageManager, Error>;

fn next(&mut self) -> Option<Self::Item> {
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-repository/src/package_manager/pnpm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl<'a> PnpmDetector<'a> {
}
}

impl<'a> Iterator for PnpmDetector<'a> {
impl Iterator for PnpmDetector<'_> {
type Item = Result<PackageManager, Error>;

fn next(&mut self) -> Option<Self::Item> {
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-repository/src/package_manager/yarn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub(crate) fn prune_patches<R: AsRef<RelativeUnixPath>>(
pruned_json
}

impl<'a> Iterator for YarnDetector<'a> {
impl Iterator for YarnDetector<'_> {
type Item = Result<PackageManager, Error>;

fn next(&mut self) -> Option<Self::Item> {
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-ui/src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ impl<W: Write> OutputClient<W> {
}
}

impl<'a, W: Write> Write for OutputWriter<'a, W> {
impl<W: Write> Write for OutputWriter<'_, W> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
for line in buf.split_inclusive(|b| *b == b'\n') {
self.buffer.extend_from_slice(line);
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-ui/src/tui/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ impl<W> App<W> {
let active_task = self.active_task()?.to_owned();
self.tasks
.get_mut(&active_task)
.ok_or_else(|| Error::TaskNotFound { name: active_task })
.ok_or(Error::TaskNotFound { name: active_task })
}

fn persist_active_task(&mut self) -> Result<(), Error> {
Expand Down
2 changes: 2 additions & 0 deletions crates/turborepo-ui/src/tui/clipboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ fn copy_impl(s: &str, provider: &Provider) -> std::io::Result<()> {
}

Provider::Exec(prog, args) => {
// Child::wait is run after writing `s` into stdin
#[allow(clippy::zombie_processes)]
let mut child = std::process::Command::new(prog)
.args(args)
.stdin(Stdio::piped())
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-ui/src/tui/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub fn start_crossterm_stream(tx: mpsc::Sender<crossterm::event::Event>) -> Opti
}))
}

impl<'a> InputOptions<'a> {
impl InputOptions<'_> {
/// Maps a crossterm::event::Event to a tui::Event
pub fn handle_crossterm_event(self, event: crossterm::event::Event) -> Option<Event> {
match event {
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-ui/src/tui/pane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl<'a, W> TerminalPane<'a, W> {
}
}

impl<'a, W> Widget for &TerminalPane<'a, W> {
impl<W> Widget for &TerminalPane<'_, W> {
fn render(self, area: ratatui::prelude::Rect, buf: &mut ratatui::prelude::Buffer)
where
Self: Sized,
Expand Down
6 changes: 3 additions & 3 deletions crates/turborepo-vt100/src/perform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ impl<'a, T: crate::callbacks::Callbacks> WrappedScreenWithCallbacks<'a, T> {
}
}

impl<'a, T: crate::callbacks::Callbacks> vte::Perform
for WrappedScreenWithCallbacks<'a, T>
impl<T: crate::callbacks::Callbacks> vte::Perform
for WrappedScreenWithCallbacks<'_, T>
{
fn print(&mut self, c: char) {
if c == '\u{fffd}' || ('\u{80}'..'\u{a0}').contains(&c) {
Expand Down Expand Up @@ -272,7 +272,7 @@ impl<'a, T: crate::callbacks::Callbacks> vte::Perform
ignore: bool,
c: char,
) {
if intermediates.first().is_none() && c == 't' {
if intermediates.is_empty() && c == 't' {
let mut iter = params.iter();
let op = iter.next().and_then(|x| x.first().copied());
if op == Some(8) {
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-vt100/src/term.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ impl<'a> ChangeTitle<'a> {
}
}

impl<'a> BufWrite for ChangeTitle<'a> {
impl BufWrite for ChangeTitle<'_> {
fn write_buf(&self, buf: &mut Vec<u8>) {
if self.icon_name == self.title
&& (self.icon_name != self.prev_icon_name
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-vt100/src/tui_term.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl tui_term::widget::Screen for crate::Screen {
}
}

impl<'a> tui_term::widget::Screen for crate::EntireScreen<'a> {
impl tui_term::widget::Screen for crate::EntireScreen<'_> {
type C = crate::Cell;

fn cell(&self, row: u16, col: u16) -> Option<&Self::C> {
Expand Down
3 changes: 2 additions & 1 deletion crates/turborepo-wax/src/walk/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ where
// `AsRef<TreeEntry>` or similar. This does not require dynamic
// dispatch, but places more restrictive constraints on entry types.
// Revisit this.
type Substituent<'a> = &'a dyn Entry
type Substituent<'a>
= &'a dyn Entry
where
Self: 'a;

Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "nightly-2024-08-30"
channel = "nightly-2024-10-11"
components = ["rustfmt", "clippy"]
profile = "minimal"
Loading