lints: A bunch of extra style lint fixes (#36568)
- **lints: Fix 'doc_lazy_continuation'** - **lints: Fix 'doc_overindented_list_items'** - **inherent_to_string and io_other_error** - **Some more lint fixes** - **lints: enable bool_assert_comparison, match_like_matches_macro and wrong_self_convention** Release Notes: - N/A
This commit is contained in:
parent
a32a264508
commit
cf7c64d77f
92 changed files with 277 additions and 345 deletions
|
@ -154,7 +154,7 @@ mod tests {
|
|||
let mut builder =
|
||||
ZipEntryBuilder::new(filename.into(), async_zip::Compression::Deflate);
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
let metadata = std::fs::metadata(&path)?;
|
||||
let metadata = std::fs::metadata(path)?;
|
||||
let perms = metadata.permissions().mode() as u16;
|
||||
builder = builder.unix_permissions(perms);
|
||||
writer.write_entry_whole(builder, &data).await?;
|
||||
|
|
|
@ -23,7 +23,7 @@ impl Display for MarkdownString {
|
|||
/// the other characters involved are escaped:
|
||||
///
|
||||
/// * `!`, `]`, `(`, and `)` are used in link syntax, but `[` is escaped so these are parsed as
|
||||
/// plaintext.
|
||||
/// plaintext.
|
||||
///
|
||||
/// * `;` is used in HTML entity syntax, but `&` is escaped, so they are parsed as plaintext.
|
||||
///
|
||||
|
|
|
@ -2,6 +2,7 @@ use globset::{Glob, GlobSet, GlobSetBuilder};
|
|||
use regex::Regex;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::cmp::Ordering;
|
||||
use std::fmt::{Display, Formatter};
|
||||
use std::path::StripPrefixError;
|
||||
use std::sync::{Arc, OnceLock};
|
||||
use std::{
|
||||
|
@ -113,10 +114,6 @@ impl SanitizedPath {
|
|||
&self.0
|
||||
}
|
||||
|
||||
pub fn to_string(&self) -> String {
|
||||
self.0.to_string_lossy().to_string()
|
||||
}
|
||||
|
||||
pub fn to_glob_string(&self) -> String {
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
|
@ -137,6 +134,12 @@ impl SanitizedPath {
|
|||
}
|
||||
}
|
||||
|
||||
impl Display for SanitizedPath {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{}", self.0.display())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<SanitizedPath> for Arc<Path> {
|
||||
fn from(sanitized_path: SanitizedPath) -> Self {
|
||||
sanitized_path.0
|
||||
|
@ -220,12 +223,8 @@ impl RemotePathBuf {
|
|||
Self::new(path_buf, style)
|
||||
}
|
||||
|
||||
pub fn to_string(&self) -> String {
|
||||
self.string.clone()
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
pub fn to_proto(self) -> String {
|
||||
pub fn to_proto(&self) -> String {
|
||||
match self.path_style() {
|
||||
PathStyle::Posix => self.to_string(),
|
||||
PathStyle::Windows => self.inner.to_string_lossy().replace('\\', "/"),
|
||||
|
@ -233,7 +232,7 @@ impl RemotePathBuf {
|
|||
}
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
pub fn to_proto(self) -> String {
|
||||
pub fn to_proto(&self) -> String {
|
||||
match self.path_style() {
|
||||
PathStyle::Posix => self.inner.to_string_lossy().to_string(),
|
||||
PathStyle::Windows => self.to_string(),
|
||||
|
@ -255,6 +254,12 @@ impl RemotePathBuf {
|
|||
}
|
||||
}
|
||||
|
||||
impl Display for RemotePathBuf {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{}", self.string)
|
||||
}
|
||||
}
|
||||
|
||||
/// A delimiter to use in `path_query:row_number:column_number` strings parsing.
|
||||
pub const FILE_ROW_COLUMN_DELIMITER: char = ':';
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue