Skip to content

Commit

Permalink
Merge pull request #750 from lucacasonato/bump_msrv
Browse files Browse the repository at this point in the history
Update Rust MSRV to 1.45
  • Loading branch information
valenting authored Jan 31, 2022
2 parents 38c8e9d + 52d736e commit 474560d
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 39 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ name: CI

on:
push:
branches: ['master']
branches: ["master"]
pull_request:

jobs:
Test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust: [1.36.0, stable, beta, nightly]
rust: [1.45.0, stable, beta, nightly]
exclude:
- os: macos-latest
rust: 1.36.0
rust: 1.45.0
- os: windows-latest
rust: 1.36.0
rust: 1.45.0
- os: macos-latest
rust: beta
- os: windows-latest
Expand Down Expand Up @@ -81,5 +81,5 @@ jobs:
Audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: EmbarkStudios/cargo-deny-action@v1
- uses: actions/checkout@v1
- uses: EmbarkStudios/cargo-deny-action@v1
2 changes: 1 addition & 1 deletion LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2013-2016 The rust-url developers
Copyright (c) 2013-2022 The rust-url developers

Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
Expand Down
1 change: 1 addition & 0 deletions data-url/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ repository = "https://github.com/servo/rust-url"
license = "MIT OR Apache-2.0"
edition = "2018"
autotests = false
rust-version = "1.45"

[dependencies]
matches = "0.1"
Expand Down
7 changes: 3 additions & 4 deletions data-url/src/mime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ fn split2(s: &str, separator: char) -> (&str, Option<&str>) {
(first, iter.next())
}

#[allow(clippy::manual_strip)] // introduced in 1.45, MSRV is 1.36
fn parse_parameters(s: &str, parameters: &mut Vec<(String, String)>) {
let mut semicolon_separated = s.split(';');

Expand All @@ -73,10 +72,10 @@ fn parse_parameters(s: &str, parameters: &mut Vec<(String, String)>) {
continue;
}
if let Some(value) = value {
let value = if value.starts_with('"') {
let max_len = value.len().saturating_sub(2); // without start or end quotes
let value = if let Some(stripped) = value.strip_prefix('"') {
let max_len = stripped.len().saturating_sub(1); // without end quote
let mut unescaped_value = String::with_capacity(max_len);
let mut chars = value[1..].chars();
let mut chars = stripped.chars();
'until_closing_quote: loop {
while let Some(c) = chars.next() {
match c {
Expand Down
1 change: 1 addition & 0 deletions form_urlencoded/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ description = "Parser and serializer for the application/x-www-form-urlencoded s
repository = "https://github.com/servo/rust-url"
license = "MIT/Apache-2.0"
edition = "2018"
rust-version = "1.45"

[lib]
test = false
Expand Down
1 change: 1 addition & 0 deletions idna/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ repository = "https://github.com/servo/rust-url/"
license = "MIT/Apache-2.0"
autotests = false
edition = "2018"
rust-version = "1.45"

[lib]
doctest = false
Expand Down
5 changes: 2 additions & 3 deletions idna/src/uts46.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ fn check_validity(label: &str, config: Config, errors: &mut Errors) {
}

/// http://www.unicode.org/reports/tr46/#Processing
#[allow(clippy::manual_strip)] // introduced in 1.45, MSRV is 1.36
fn processing(
domain: &str,
config: Config,
Expand Down Expand Up @@ -384,8 +383,8 @@ fn processing(
output.push('.');
}
first = false;
if label.starts_with(PUNYCODE_PREFIX) {
match decoder.decode(&label[PUNYCODE_PREFIX.len()..]) {
if let Some(remainder) = label.strip_prefix(PUNYCODE_PREFIX) {
match decoder.decode(remainder) {
Ok(decode) => {
let start = output.len();
output.extend(decode);
Expand Down
1 change: 1 addition & 0 deletions percent_encoding/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ description = "Percent encoding and decoding"
repository = "https://github.com/servo/rust-url/"
license = "MIT/Apache-2.0"
edition = "2018"
rust-version = "1.45"

[features]
default = ["alloc"]
Expand Down
1 change: 1 addition & 0 deletions url/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ categories = ["parser-implementations", "web-programming", "encoding"]
license = "MIT/Apache-2.0"
include = ["src/**/*", "LICENSE-*", "README.md", "tests/**"]
edition = "2018"
rust-version = "1.45"

[badges]
travis-ci = { repository = "servo/rust-url" }
Expand Down
10 changes: 2 additions & 8 deletions url/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1244,14 +1244,9 @@ impl Url {
/// # }
/// # run().unwrap();
/// ```
#[allow(clippy::manual_strip)] // introduced in 1.45, MSRV is 1.36
pub fn path_segments(&self) -> Option<str::Split<'_, char>> {
let path = self.path();
if path.starts_with('/') {
Some(path[1..].split('/'))
} else {
None
}
path.strip_prefix('/').map(|remainder| remainder.split('/'))
}

/// Return this URL’s query string, if any, as a percent-encoded ASCII string.
Expand Down Expand Up @@ -1361,8 +1356,7 @@ impl Url {
}

fn mutate<F: FnOnce(&mut Parser<'_>) -> R, R>(&mut self, f: F) -> R {
#[allow(clippy::mem_replace_with_default)] // introduced in 1.40, MSRV is 1.36
let mut parser = Parser::for_setter(mem::replace(&mut self.serialization, String::new()));
let mut parser = Parser::for_setter(mem::take(&mut self.serialization));
let result = f(&mut parser);
self.serialization = parser.serialization;
result
Expand Down
16 changes: 2 additions & 14 deletions url/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,12 @@ macro_rules! simple_enum_error {
///
/// This may be extended in the future so exhaustive matching is
/// discouraged with an unused variant.
#[allow(clippy::manual_non_exhaustive)] // introduced in 1.40, MSRV is 1.36
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
#[non_exhaustive]
pub enum ParseError {
$(
$name,
)+
/// Unused variant enable non-exhaustive matching
#[doc(hidden)]
__FutureProof,
}

impl fmt::Display for ParseError {
Expand All @@ -69,9 +66,6 @@ macro_rules! simple_enum_error {
$(
ParseError::$name => fmt.write_str($description),
)+
ParseError::__FutureProof => {
unreachable!("Don't abuse the FutureProof!");
}
}
}
}
Expand Down Expand Up @@ -106,15 +100,12 @@ macro_rules! syntax_violation_enum {
///
/// This may be extended in the future so exhaustive matching is
/// discouraged with an unused variant.
#[allow(clippy::manual_non_exhaustive)] // introduced in 1.40, MSRV is 1.36
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
#[non_exhaustive]
pub enum SyntaxViolation {
$(
$name,
)+
/// Unused variant enable non-exhaustive matching
#[doc(hidden)]
__FutureProof,
}

impl SyntaxViolation {
Expand All @@ -123,9 +114,6 @@ macro_rules! syntax_violation_enum {
$(
SyntaxViolation::$name => $description,
)+
SyntaxViolation::__FutureProof => {
unreachable!("Don't abuse the FutureProof!");
}
}
}
}
Expand Down
4 changes: 1 addition & 3 deletions url/tests/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

//! Data-driven tests
use std::ops::Deref;
use std::str::FromStr;

use serde_json::Value;
Expand Down Expand Up @@ -112,7 +111,6 @@ fn urltestdata() {
assert!(passed)
}

#[allow(clippy::option_as_ref_deref)] // introduced in 1.40, MSRV is 1.36
#[test]
fn setters_tests() {
let mut json = Value::from_str(include_str!("setters_tests.json"))
Expand Down Expand Up @@ -141,7 +139,7 @@ fn setters_tests() {
let mut expected = test.take_key("expected").unwrap();

let mut url = Url::parse(&href).unwrap();
let comment_ref = comment.as_ref().map(|s| s.deref());
let comment_ref = comment.as_deref();
passed &= check_invariants(&url, &name, comment_ref);
let _ = set(&mut url, attr, &new_value);

Expand Down

0 comments on commit 474560d

Please sign in to comment.