Fix failing lints.

Two crates did not specify that they inherited lints from the workspace,
and were thus not being linted (this is caught automatically in the
newest version of rust).

Change-Id: I43a1ac2f7dada05b6fd20b8a3b4706576a6a6964
Reviewed-on: https://gn-review.googlesource.com/c/gn/+/27040
Reviewed-by: Takuto Ikuta <tikuta@google.com>
Commit-Queue: Matt Stark <msta@google.com>
diff --git a/src/gn/starlark/crates/rule/Cargo.toml b/src/gn/starlark/crates/rule/Cargo.toml
index c4cd8b0..b38ce3f 100644
--- a/src/gn/starlark/crates/rule/Cargo.toml
+++ b/src/gn/starlark/crates/rule/Cargo.toml
@@ -3,6 +3,9 @@
 version = "0.1.0"
 edition = "2021"
 
+[lints]
+workspace = true
+
 [lib]
 doctest = false
 
diff --git a/src/gn/starlark/crates/rule/src/actions.rs b/src/gn/starlark/crates/rule/src/actions.rs
index 52317c0..0360557 100644
--- a/src/gn/starlark/crates/rule/src/actions.rs
+++ b/src/gn/starlark/crates/rule/src/actions.rs
@@ -28,7 +28,7 @@
 
 // Safety: This is a zero-sized type. All are equivalent.
 unsafe impl<'v, C: EvalContextAttrExt + CtxMethods> ProvidesStaticType<'v> for Actions<C> {
-    type StaticType = Actions<C>;
+    type StaticType = Self;
 }
 
 impl<C: EvalContextAttrExt + CtxMethods> Default for Actions<C> {
diff --git a/src/gn/starlark/crates/rule/src/errors.rs b/src/gn/starlark/crates/rule/src/errors.rs
index 335c2f0..c6f051a 100644
--- a/src/gn/starlark/crates/rule/src/errors.rs
+++ b/src/gn/starlark/crates/rule/src/errors.rs
@@ -22,7 +22,7 @@
 
 impl From<Error> for starlark::Error {
     fn from(err: Error) -> Self {
-        starlark::Error::new_other(err)
+        Self::new_other(err)
     }
 }
 
diff --git a/src/gn/starlark/crates/rule/src/globals.rs b/src/gn/starlark/crates/rule/src/globals.rs
index 9d1660a..53ec952 100644
--- a/src/gn/starlark/crates/rule/src/globals.rs
+++ b/src/gn/starlark/crates/rule/src/globals.rs
@@ -7,7 +7,7 @@
     environment::{FrozenModule, Module},
     values::FrozenHeapName,
 };
-use strum::IntoEnumIterator;
+use strum::IntoEnumIterator as _;
 
 use crate::{OutputType, Rule};
 
diff --git a/src/gn/starlark/crates/rule/src/implementation.rs b/src/gn/starlark/crates/rule/src/implementation.rs
index e42d959..14b0bb4 100644
--- a/src/gn/starlark/crates/rule/src/implementation.rs
+++ b/src/gn/starlark/crates/rule/src/implementation.rs
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-use attr::{traits::EvalContextAttrExt, TargetAttrExt, TargetRef};
+use attr::{traits::EvalContextAttrExt, TargetAttrExt};
 use starlark::{
     environment::Module,
     eval::Evaluator,
     values::{HeapEdge, OwnedFrozen, Value},
 };
-use types::{EvaluatorContextExt, Session};
+use types::{EvaluatorContextExt as _, Session, TargetRef as _};
 
 use crate::{Ctx, Rule};
 
diff --git a/src/gn/starlark/crates/rule/src/rule.rs b/src/gn/starlark/crates/rule/src/rule.rs
index 8b9ee27..ac6781d 100644
--- a/src/gn/starlark/crates/rule/src/rule.rs
+++ b/src/gn/starlark/crates/rule/src/rule.rs
@@ -17,7 +17,7 @@
 };
 use starlark_derive::{starlark_value, NoSerialize};
 pub use types::OutputType;
-use types::{EvaluatorContextExt, Scope};
+use types::{EvaluatorContextExt as _, Scope as _};
 
 /// Representation of a Starlark rule object.
 ///
@@ -37,7 +37,7 @@
     pub(crate) once_named: OnceCell<(String, ParametersSpec<Value<'static>>)>,
     pub(crate) builtin: Option<OutputType>,
     pub(crate) implementation: Value<'v>,
-    pub(crate) parent: Option<ValueTyped<'v, Rule<'v, C>>>,
+    pub(crate) parent: Option<ValueTyped<'v, Self>>,
     pub(crate) _phantom: PhantomData<C>,
 }
 
@@ -98,7 +98,7 @@
     pub fn new<'fh>(
         attrs: SmallMap<String, AttrSchema>,
         builtin: Option<OutputType>,
-        parent: Option<ValueTyped<'v, Rule<'v, C>>>,
+        parent: Option<ValueTyped<'v, Self>>,
         implementation: Value<'v>,
         frozen_heap: &FrozenHeap<'fh>,
         edge: HeapEdge<'v, 'fh>,
@@ -142,7 +142,7 @@
         let name: &str = builtin.into();
         let signature = build_signature(name, &schema, true);
         let once_named = OnceCell::new();
-        let _ = once_named.set((name.to_owned(), signature));
+        drop(once_named.set((name.to_owned(), signature)));
         Self {
             schema,
             once_named,
@@ -188,7 +188,7 @@
         _eval: &mut Evaluator<'v, '_, '_>,
     ) -> starlark::Result<()> {
         let signature = build_signature(variable_name, &self.schema, self.builtin.is_some());
-        let _ = self.once_named.set((variable_name.to_owned(), signature));
+        drop(self.once_named.set((variable_name.to_owned(), signature)));
         Ok(())
     }
 
diff --git a/src/gn/starlark/crates/rule/tests/actions.rs b/src/gn/starlark/crates/rule/tests/actions.rs
index 45d9654..571af1a 100644
--- a/src/gn/starlark/crates/rule/tests/actions.rs
+++ b/src/gn/starlark/crates/rule/tests/actions.rs
@@ -8,7 +8,7 @@
 use rule::run;
 use tempfile::tempdir;
 use testutils::Assert;
-use types::{Label, PackageRef, Session};
+use types::{Label, PackageRef, Session as _};
 
 #[test]
 fn test_actions_suite() {
diff --git a/src/gn/starlark/crates/rule/tests/ctx_super.rs b/src/gn/starlark/crates/rule/tests/ctx_super.rs
index 8ddcaec..2148819 100644
--- a/src/gn/starlark/crates/rule/tests/ctx_super.rs
+++ b/src/gn/starlark/crates/rule/tests/ctx_super.rs
@@ -5,7 +5,7 @@
 use rule::run;
 use starlark::values::list::ListRef;
 use testutils::Assert;
-use types::{Label, PackageRef, Session};
+use types::{Label, PackageRef, Session as _};
 
 #[test]
 fn test_ctx_super() {
diff --git a/src/gn/starlark/crates/rule/tests/frozen_rule.rs b/src/gn/starlark/crates/rule/tests/frozen_rule.rs
index f7e364b..63ab5c2 100644
--- a/src/gn/starlark/crates/rule/tests/frozen_rule.rs
+++ b/src/gn/starlark/crates/rule/tests/frozen_rule.rs
@@ -8,7 +8,7 @@
 use rule::Rule;
 use starlark::environment::FrozenModule;
 use testutils::{Assert, FakeEvalContext, FakeTarget};
-use types::{Label, OutputType, PackageRef, Session};
+use types::{Label, OutputType, PackageRef, Session as _};
 
 fn new_assert() -> Assert {
     Assert::new_rule_assert()
diff --git a/src/gn/starlark/crates/testutils/Cargo.toml b/src/gn/starlark/crates/testutils/Cargo.toml
index 410da82..97f92b8 100644
--- a/src/gn/starlark/crates/testutils/Cargo.toml
+++ b/src/gn/starlark/crates/testutils/Cargo.toml
@@ -3,6 +3,9 @@
 version = "0.1.0"
 edition = "2021"
 
+[lints]
+workspace = true
+
 [lib]
 test = false
 doctest = false
diff --git a/src/gn/starlark/crates/testutils/src/assert.rs b/src/gn/starlark/crates/testutils/src/assert.rs
index 517bcc8..6338515 100644
--- a/src/gn/starlark/crates/testutils/src/assert.rs
+++ b/src/gn/starlark/crates/testutils/src/assert.rs
@@ -8,7 +8,7 @@
     environment::{FrozenModule, GlobalsBuilder},
     values::UnpackValue,
 };
-use types::{EvalContext, EvaluatorContextExt, Label, PathResolver};
+use types::{EvalContext as _, EvaluatorContextExt as _, Label, PathResolver};
 
 use crate::{register_globals, FakeEvalContext, FakeSession};
 
@@ -42,7 +42,7 @@
         // under the "always GC" configuration), ensuring state is mutated only once.
         assert.always_gc();
         let context = Box::new(context);
-        let context_ptr = &*context as *const FakeEvalContext;
+        let context_ptr = &raw const *context;
 
         assert.setup_eval(move |eval| {
             // Safety: The context is owned by Assert, which outlives the evaluator run.
diff --git a/src/gn/starlark/crates/testutils/src/eval_context.rs b/src/gn/starlark/crates/testutils/src/eval_context.rs
index 83042a0..d42bcef 100644
--- a/src/gn/starlark/crates/testutils/src/eval_context.rs
+++ b/src/gn/starlark/crates/testutils/src/eval_context.rs
@@ -14,7 +14,7 @@
 };
 use types::{
     CtxState, Label, LabelRef, OutputType, Package, PackageRef, PathResolver, Scope, Session,
-    TargetRef,
+    TargetRef as _,
 };
 
 use crate::{FakeSession, FakeTarget, FakeTargetRef};
@@ -163,7 +163,8 @@
         targets.push(Box::new(target));
         // Safety: The Box inside the RefCell's vector is stable in memory and lasts as
         // long as the FakeSession in tests.
-        let target_ref = unsafe { &mut *(&mut **targets.last_mut().unwrap() as *mut FakeTarget) };
+        let target_ref =
+            unsafe { std::ptr::NonNull::from(targets.last_mut().unwrap().as_mut()).as_mut() };
         Ok(unsafe { std::pin::Pin::new_unchecked(target_ref) })
     }
 
@@ -173,15 +174,14 @@
         rule: Value<'static>,
         attrs: Vec<Attr>,
     ) -> Result<FakeTargetRef> {
-        let target_ptr = cxx_target as *const FakeTarget;
+        let target_ptr = std::ptr::from_ref::<FakeTarget>(cxx_target);
         let mut targets = self.session.targets_under_construction.borrow_mut();
         let idx = targets
             .iter()
-            .position(|t| std::ptr::eq(&**t, target_ptr))
+            .position(|t| std::ptr::eq(&raw const **t, target_ptr))
             .expect("Registering target that was not created in this context");
         let mut target = targets.remove(idx);
-        let typed =
-            FrozenValueTyped::<'static, rule::Rule<'static, FakeEvalContext>>::new_err(rule)?;
+        let typed = FrozenValueTyped::<'static, rule::Rule<'static, Self>>::new_err(rule)?;
         target.rule = typed.has_implementation().then(|| typed.as_ref());
         target.attrs = attrs;
         Ok(self.session.insert_target(*target))
diff --git a/src/gn/starlark/crates/testutils/src/session.rs b/src/gn/starlark/crates/testutils/src/session.rs
index b161fbc..7df6f8f 100644
--- a/src/gn/starlark/crates/testutils/src/session.rs
+++ b/src/gn/starlark/crates/testutils/src/session.rs
@@ -5,7 +5,7 @@
 use std::{cell::RefCell, collections::HashSet};
 
 use attr::Session;
-use types::{Label, LabelRef, PackageRef, TargetRef};
+use types::{Label, LabelRef, PackageRef, TargetRef as _};
 
 use crate::{FakeTarget, FakeTargetRef};
 
@@ -91,8 +91,7 @@
             target.clone()
         } else {
             panic!(
-                "get_target failed to find label: {:?}, toolchain: {:?}. Available targets: {:?}",
-                label, current_toolchain, targets
+                "get_target failed to find label: {label:?}, toolchain: {current_toolchain:?}. Available targets: {targets:?}"
             );
         }
     }
diff --git a/src/gn/starlark/crates/testutils/src/target.rs b/src/gn/starlark/crates/testutils/src/target.rs
index 086994d..3ea3a04 100644
--- a/src/gn/starlark/crates/testutils/src/target.rs
+++ b/src/gn/starlark/crates/testutils/src/target.rs
@@ -44,7 +44,7 @@
             && self.outputs == other.outputs
             && self.attrs == other.attrs
             && self.output_type == other.output_type
-            && self.rule.map(|r| r as *const _) == other.rule.map(|r| r as *const _)
+            && self.rule.map(std::ptr::from_ref) == other.rule.map(std::ptr::from_ref)
             && self.cxx_attrs.len() == other.cxx_attrs.len()
             && self.cxx_attrs.iter().all(|(k, v)| {
                 other