mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Elide lifetimes where possible after rustup (#34824)
The new version of rust allows us to elide some lifetimes and clippy is now complaining about this. This change elides them where possible and removes the clippy exceptions. Fixes #34804. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
92026cb094
commit
621ddd749c
57 changed files with 92 additions and 99 deletions
|
@ -105,7 +105,7 @@ pub struct DocumentsIter<'a> {
|
|||
iter: hash_map::Iter<'a, PipelineId, Dom<Document>>,
|
||||
}
|
||||
|
||||
impl<'a> Iterator for DocumentsIter<'a> {
|
||||
impl Iterator for DocumentsIter<'_> {
|
||||
type Item = (PipelineId, DomRoot<Document>);
|
||||
|
||||
fn next(&mut self) -> Option<(PipelineId, DomRoot<Document>)> {
|
||||
|
|
|
@ -315,7 +315,7 @@ impl Convert<LatencyCategory> for AudioContextLatencyCategory {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Convert<RealTimeAudioContextOptions> for &'a AudioContextOptions {
|
||||
impl Convert<RealTimeAudioContextOptions> for &AudioContextOptions {
|
||||
fn convert(self) -> RealTimeAudioContextOptions {
|
||||
RealTimeAudioContextOptions {
|
||||
sample_rate: *self.sampleRate.unwrap_or(Finite::wrap(44100.)),
|
||||
|
|
|
@ -216,7 +216,7 @@ impl<T: DomObject> ThisReflector for T {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> ThisReflector for HandleObject<'a> {
|
||||
impl ThisReflector for HandleObject<'_> {
|
||||
fn jsobject(&self) -> *mut JSObject {
|
||||
self.get()
|
||||
}
|
||||
|
|
|
@ -260,7 +260,7 @@ impl<'a> ThreadLocalStackRoots<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Drop for ThreadLocalStackRoots<'a> {
|
||||
impl Drop for ThreadLocalStackRoots<'_> {
|
||||
fn drop(&mut self) {
|
||||
STACK_ROOTS.with(|r| r.set(None));
|
||||
}
|
||||
|
@ -698,7 +698,7 @@ impl<T: DomObject> PartialEq for MutNullableDom<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, T: DomObject> PartialEq<Option<&'a T>> for MutNullableDom<T> {
|
||||
impl<T: DomObject> PartialEq<Option<&T>> for MutNullableDom<T> {
|
||||
fn eq(&self, other: &Option<&T>) -> bool {
|
||||
unsafe { *self.ptr.get() == other.map(Dom::from_ref) }
|
||||
}
|
||||
|
|
|
@ -356,7 +356,7 @@ impl From<String> for DOMString {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a str> for DOMString {
|
||||
impl From<&str> for DOMString {
|
||||
fn from(contents: &str) -> DOMString {
|
||||
DOMString::from(String::from(contents))
|
||||
}
|
||||
|
|
|
@ -187,7 +187,7 @@ impl BiquadFilterNodeMethods<crate::DomTypeHolder> for BiquadFilterNode {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Convert<BiquadFilterNodeOptions> for &'a BiquadFilterOptions {
|
||||
impl Convert<BiquadFilterNodeOptions> for &BiquadFilterOptions {
|
||||
fn convert(self) -> BiquadFilterNodeOptions {
|
||||
BiquadFilterNodeOptions {
|
||||
gain: *self.gain,
|
||||
|
|
|
@ -75,7 +75,7 @@ pub trait ToFillOrStrokeStyle {
|
|||
fn to_fill_or_stroke_style(self) -> FillOrStrokeStyle;
|
||||
}
|
||||
|
||||
impl<'a> ToFillOrStrokeStyle for &'a CanvasGradient {
|
||||
impl ToFillOrStrokeStyle for &CanvasGradient {
|
||||
fn to_fill_or_stroke_style(self) -> FillOrStrokeStyle {
|
||||
let gradient_stops = self.stops.borrow().clone();
|
||||
match self.style {
|
||||
|
|
|
@ -70,7 +70,7 @@ impl CanvasPattern {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> ToFillOrStrokeStyle for &'a CanvasPattern {
|
||||
impl ToFillOrStrokeStyle for &CanvasPattern {
|
||||
fn to_fill_or_stroke_style(self) -> FillOrStrokeStyle {
|
||||
FillOrStrokeStyle::Surface(SurfaceStyle::new(
|
||||
self.surface_data.clone(),
|
||||
|
|
|
@ -83,7 +83,7 @@ impl<'a> AutoWorkerReset<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Drop for AutoWorkerReset<'a> {
|
||||
impl Drop for AutoWorkerReset<'_> {
|
||||
fn drop(&mut self) {
|
||||
self.workerscope
|
||||
.worker
|
||||
|
|
|
@ -681,7 +681,7 @@ pub trait LayoutElementHelpers<'dom> {
|
|||
fn get_attr_vals_for_layout(self, name: &LocalName) -> Vec<&'dom AttrValue>;
|
||||
}
|
||||
|
||||
impl<'dom> LayoutDom<'dom, Element> {
|
||||
impl LayoutDom<'_, Element> {
|
||||
pub(super) fn focus_state(self) -> bool {
|
||||
self.unsafe_get().state.get().contains(ElementState::FOCUS)
|
||||
}
|
||||
|
@ -4361,7 +4361,7 @@ pub enum AttributeMutation<'a> {
|
|||
Removed,
|
||||
}
|
||||
|
||||
impl<'a> AttributeMutation<'a> {
|
||||
impl AttributeMutation<'_> {
|
||||
pub fn is_removal(&self) -> bool {
|
||||
match *self {
|
||||
AttributeMutation::Removed => true,
|
||||
|
|
|
@ -1383,7 +1383,7 @@ pub enum FormSubmitterElement<'a> {
|
|||
// (including custom elements) that can be passed as submitter.
|
||||
}
|
||||
|
||||
impl<'a> FormSubmitterElement<'a> {
|
||||
impl FormSubmitterElement<'_> {
|
||||
fn action(&self) -> DOMString {
|
||||
match *self {
|
||||
FormSubmitterElement::Form(form) => form.Action(),
|
||||
|
|
|
@ -195,7 +195,7 @@ impl InputType {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a Atom> for InputType {
|
||||
impl From<&Atom> for InputType {
|
||||
fn from(value: &Atom) -> InputType {
|
||||
match value.to_ascii_lowercase() {
|
||||
atom!("button") => InputType::Button,
|
||||
|
|
|
@ -73,7 +73,7 @@ trait ProcessDataURL {
|
|||
fn process_data_url(&self);
|
||||
}
|
||||
|
||||
impl<'a> ProcessDataURL for &'a HTMLObjectElement {
|
||||
impl ProcessDataURL for &HTMLObjectElement {
|
||||
// Makes the local `data` member match the status of the `data` attribute and starts
|
||||
/// prefetching the image. This method must be called after `data` is changed.
|
||||
fn process_data_url(&self) {
|
||||
|
|
|
@ -157,7 +157,7 @@ impl OscillatorNodeMethods<crate::DomTypeHolder> for OscillatorNode {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Convert<ServoMediaOscillatorOptions> for &'a OscillatorOptions {
|
||||
impl Convert<ServoMediaOscillatorOptions> for &OscillatorOptions {
|
||||
fn convert(self) -> ServoMediaOscillatorOptions {
|
||||
ServoMediaOscillatorOptions {
|
||||
oscillator_type: self.type_.convert(),
|
||||
|
|
|
@ -373,7 +373,7 @@ impl PannerNodeMethods<crate::DomTypeHolder> for PannerNode {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Convert<PannerNodeOptions> for &'a PannerOptions {
|
||||
impl Convert<PannerNodeOptions> for &PannerOptions {
|
||||
fn convert(self) -> PannerNodeOptions {
|
||||
PannerNodeOptions {
|
||||
panning_model: self.panningModel.convert(),
|
||||
|
|
|
@ -837,7 +837,7 @@ impl Convert<RTCSessionDescriptionInit> for SessionDescription {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Convert<SessionDescription> for &'a RTCSessionDescriptionInit {
|
||||
impl Convert<SessionDescription> for &RTCSessionDescriptionInit {
|
||||
fn convert(self) -> SessionDescription {
|
||||
let type_ = match self.type_ {
|
||||
RTCSdpType::Answer => SdpType::Answer,
|
||||
|
|
|
@ -212,7 +212,7 @@ impl Iterator for SerializationIterator {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Serialize for &'a Node {
|
||||
impl Serialize for &Node {
|
||||
fn serialize<S: Serializer>(
|
||||
&self,
|
||||
serializer: &mut S,
|
||||
|
|
|
@ -456,7 +456,7 @@ impl TreeWalker {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Iterator for &'a TreeWalker {
|
||||
impl Iterator for &TreeWalker {
|
||||
type Item = DomRoot<Node>;
|
||||
|
||||
fn next(&mut self) -> Option<DomRoot<Node>> {
|
||||
|
|
|
@ -107,7 +107,7 @@ pub struct CommonTexImage2DValidatorResult {
|
|||
pub border: u32,
|
||||
}
|
||||
|
||||
impl<'a> WebGLValidator for CommonTexImage2DValidator<'a> {
|
||||
impl WebGLValidator for CommonTexImage2DValidator<'_> {
|
||||
type Error = TexImageValidationError;
|
||||
type ValidatedOutput = CommonTexImage2DValidatorResult;
|
||||
fn validate(self) -> Result<Self::ValidatedOutput, TexImageValidationError> {
|
||||
|
@ -299,7 +299,7 @@ pub struct TexImage2DValidatorResult {
|
|||
|
||||
/// TexImage2d validator as per
|
||||
/// <https://www.khronos.org/opengles/sdk/docs/man/xhtml/glTexImage2D.xml>
|
||||
impl<'a> WebGLValidator for TexImage2DValidator<'a> {
|
||||
impl WebGLValidator for TexImage2DValidator<'_> {
|
||||
type ValidatedOutput = TexImage2DValidatorResult;
|
||||
type Error = TexImageValidationError;
|
||||
|
||||
|
@ -459,7 +459,7 @@ fn is_subimage_blockaligned(
|
|||
(height % block_height == 0 || yoffset + height == tex_info.height())
|
||||
}
|
||||
|
||||
impl<'a> WebGLValidator for CommonCompressedTexImage2DValidator<'a> {
|
||||
impl WebGLValidator for CommonCompressedTexImage2DValidator<'_> {
|
||||
type Error = TexImageValidationError;
|
||||
type ValidatedOutput = CommonCompressedTexImage2DValidatorResult;
|
||||
|
||||
|
@ -537,7 +537,7 @@ impl<'a> CompressedTexImage2DValidator<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> WebGLValidator for CompressedTexImage2DValidator<'a> {
|
||||
impl WebGLValidator for CompressedTexImage2DValidator<'_> {
|
||||
type Error = TexImageValidationError;
|
||||
type ValidatedOutput = CommonCompressedTexImage2DValidatorResult;
|
||||
|
||||
|
@ -617,7 +617,7 @@ impl<'a> CompressedTexSubImage2DValidator<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> WebGLValidator for CompressedTexSubImage2DValidator<'a> {
|
||||
impl WebGLValidator for CompressedTexSubImage2DValidator<'_> {
|
||||
type Error = TexImageValidationError;
|
||||
type ValidatedOutput = CommonCompressedTexImage2DValidatorResult;
|
||||
|
||||
|
@ -728,7 +728,7 @@ impl<'a> TexStorageValidator<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> WebGLValidator for TexStorageValidator<'a> {
|
||||
impl WebGLValidator for TexStorageValidator<'_> {
|
||||
type Error = TexImageValidationError;
|
||||
type ValidatedOutput = TexStorageValidatorResult;
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ pub struct ServoLayoutElement<'dom> {
|
|||
element: LayoutDom<'dom, Element>,
|
||||
}
|
||||
|
||||
impl<'dom> fmt::Debug for ServoLayoutElement<'dom> {
|
||||
impl fmt::Debug for ServoLayoutElement<'_> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "<{}", self.element.local_name())?;
|
||||
if let Some(id) = self.id() {
|
||||
|
@ -800,7 +800,7 @@ impl<'dom> ThreadSafeLayoutElement<'dom> for ServoThreadSafeLayoutElement<'dom>
|
|||
///
|
||||
/// Note that the element implementation is needed only for selector matching,
|
||||
/// not for inheritance (styles are inherited appropriately).
|
||||
impl<'dom> ::selectors::Element for ServoThreadSafeLayoutElement<'dom> {
|
||||
impl ::selectors::Element for ServoThreadSafeLayoutElement<'_> {
|
||||
type Impl = SelectorImpl;
|
||||
|
||||
fn opaque(&self) -> ::selectors::OpaqueElement {
|
||||
|
|
|
@ -59,7 +59,7 @@ pub struct ServoLayoutNode<'dom> {
|
|||
unsafe impl Send for ServoLayoutNode<'_> {}
|
||||
unsafe impl Sync for ServoLayoutNode<'_> {}
|
||||
|
||||
impl<'dom> fmt::Debug for ServoLayoutNode<'dom> {
|
||||
impl fmt::Debug for ServoLayoutNode<'_> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
if let Some(el) = self.as_element() {
|
||||
el.fmt(f)
|
||||
|
@ -95,7 +95,7 @@ impl<'dom> ServoLayoutNode<'dom> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'dom> style::dom::NodeInfo for ServoLayoutNode<'dom> {
|
||||
impl style::dom::NodeInfo for ServoLayoutNode<'_> {
|
||||
fn is_element(&self) -> bool {
|
||||
self.node.is_element_for_layout()
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ impl<'dom> ServoThreadSafeLayoutNode<'dom> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'dom> style::dom::NodeInfo for ServoThreadSafeLayoutNode<'dom> {
|
||||
impl style::dom::NodeInfo for ServoThreadSafeLayoutNode<'_> {
|
||||
fn is_element(&self) -> bool {
|
||||
self.node.is_element()
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ pub struct ServoShadowRoot<'dom> {
|
|||
shadow_root: LayoutDom<'dom, ShadowRoot>,
|
||||
}
|
||||
|
||||
impl<'dom> fmt::Debug for ServoShadowRoot<'dom> {
|
||||
impl fmt::Debug for ServoShadowRoot<'_> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
self.as_node().fmt(f)
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#![register_tool(crown)]
|
||||
#![cfg_attr(any(doc, clippy), allow(unknown_lints))]
|
||||
#![deny(crown_is_not_used)]
|
||||
#![allow(clippy::needless_lifetimes)]
|
||||
|
||||
// These are used a lot so let's keep them for now
|
||||
#[macro_use]
|
||||
|
|
|
@ -33,7 +33,7 @@ pub enum InRealm<'a> {
|
|||
Entered(&'a JSAutoRealm),
|
||||
}
|
||||
|
||||
impl<'a> InRealm<'a> {
|
||||
impl InRealm<'_> {
|
||||
pub fn already(token: &AlreadyInRealm) -> InRealm {
|
||||
InRealm::Already(token)
|
||||
}
|
||||
|
|
|
@ -463,7 +463,7 @@ impl<'a> ScriptMemoryFailsafe<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Drop for ScriptMemoryFailsafe<'a> {
|
||||
impl Drop for ScriptMemoryFailsafe<'_> {
|
||||
#[allow(crown::unrooted_must_root)]
|
||||
fn drop(&mut self) {
|
||||
if let Some(owner) = self.owner {
|
||||
|
|
|
@ -302,7 +302,7 @@ impl<'a> StylesheetLoader<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> StylesheetLoader<'a> {
|
||||
impl StylesheetLoader<'_> {
|
||||
pub fn load(
|
||||
&self,
|
||||
source: StylesheetContextSource,
|
||||
|
@ -373,7 +373,7 @@ pub(crate) fn stylesheet_fetch_request(
|
|||
.integrity_metadata(integrity_metadata)
|
||||
}
|
||||
|
||||
impl<'a> StyleStylesheetLoader for StylesheetLoader<'a> {
|
||||
impl StyleStylesheetLoader for StylesheetLoader<'_> {
|
||||
/// Request a stylesheet after parsing a given `@import` rule, and return
|
||||
/// the constructed `@import` rule.
|
||||
fn request_stylesheet(
|
||||
|
|
|
@ -18,7 +18,7 @@ where
|
|||
Document(&'a mut DocumentStylesheetSet<S>),
|
||||
}
|
||||
|
||||
impl<'a, S> StylesheetSetRef<'a, S>
|
||||
impl<S> StylesheetSetRef<'_, S>
|
||||
where
|
||||
S: StylesheetInDocument + PartialEq + 'static,
|
||||
{
|
||||
|
|
|
@ -78,7 +78,7 @@ pub struct EvalNodesetIter<'a> {
|
|||
size: usize,
|
||||
}
|
||||
|
||||
impl<'a> Iterator for EvalNodesetIter<'a> {
|
||||
impl Iterator for EvalNodesetIter<'_> {
|
||||
type Item = EvaluationCtx;
|
||||
|
||||
fn next(&mut self) -> Option<EvaluationCtx> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue