From aae67bd572ad86f4c57e364daa51a9dc883b8913 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sun, 3 Jan 2021 00:12:09 +0100 Subject: =?UTF-8?q?Move=20and=20rename=20many=20things=20=F0=9F=9A=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/syntax/span.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/syntax/span.rs') diff --git a/src/syntax/span.rs b/src/syntax/span.rs index 20008354..3be770b8 100644 --- a/src/syntax/span.rs +++ b/src/syntax/span.rs @@ -1,5 +1,3 @@ -//! Mapping of values to the locations they originate from in source code. - use std::fmt::{self, Debug, Display, Formatter}; use std::ops::Range; @@ -66,12 +64,18 @@ impl Spanned { } /// Map the value using a function while keeping the span. - pub fn map(self, f: impl FnOnce(T) -> U) -> Spanned { + pub fn map(self, f: F) -> Spanned + where + F: FnOnce(T) -> U, + { Spanned { v: f(self.v), span: self.span } } /// Maps the span while keeping the value. - pub fn map_span(mut self, f: impl FnOnce(Span) -> Span) -> Self { + pub fn map_span(mut self, f: F) -> Self + where + F: FnOnce(Span) -> Span, + { self.span = f(self.span); self } @@ -102,7 +106,7 @@ impl Debug for Spanned { } } -/// Locates a slice of source code. +/// Bounds of a slice of source code. #[derive(Copy, Clone, Ord, PartialOrd)] #[cfg_attr(feature = "serde", derive(serde::Serialize))] pub struct Span { -- cgit v1.2.3