Skip to content

Commit

Permalink
update ci toolchain setup (#222)
Browse files Browse the repository at this point in the history
* Update ci.yml

Signed-off-by: Yuwei Ba <[email protected]>

* Update ci.yml

Signed-off-by: Yuwei Ba <[email protected]>

* fmt

---------

Signed-off-by: Yuwei Ba <[email protected]>
  • Loading branch information
ibigbug authored Dec 25, 2023
1 parent 4656d26 commit 9980ab0
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 34 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ jobs:
with:
go-version: '1.20'
- uses: ilammy/setup-nasm@v1
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Run cargo fmt
run: cargo fmt --all -- --check
- name: Run cargo check
run: cargo check --all --all-features
- name: Run cargo clippy
Expand Down
6 changes: 3 additions & 3 deletions clash_lib/src/app/api/handlers/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ async fn patch_configs(

inbound_manager.rebuild_listeners(ports);

if let Some(h) = global_state
.inbound_listener_handle
.take() { h.abort() }
if let Some(h) = global_state.inbound_listener_handle.take() {
h.abort()
}

let r = inbound_manager.get_runner().unwrap();

Expand Down
6 changes: 1 addition & 5 deletions clash_lib/src/config/def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,11 +391,7 @@ impl FromStr for Config {

fn from_str(s: &str) -> Result<Self, Self::Err> {
serde_yaml::from_str(s).map_err(|x| {
Error::InvalidConfig(format!(
"cound not parse config content {}: {}",
s,
x
))
Error::InvalidConfig(format!("cound not parse config content {}: {}", s, x))
})
}
}
Expand Down
10 changes: 4 additions & 6 deletions clash_lib/src/proxy/converters/trojan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,10 @@ impl TryFrom<&OutboundTrojan> for AnyOutboundHandler {
.ok_or(Error::InvalidConfig(
"grpc_opts is required for grpc".to_owned(),
)),
_ => {
Err(Error::InvalidConfig(format!(
"unsupported trojan network: {}",
x
)))
}
_ => Err(Error::InvalidConfig(format!(
"unsupported trojan network: {}",
x
))),
})
.transpose()?,
});
Expand Down
15 changes: 5 additions & 10 deletions clash_lib/src/proxy/converters/vmess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,7 @@ impl TryFrom<&OutboundVmess> for AnyOutboundHandler {
.ok_or(Error::InvalidConfig(
"grpc_opts is required for grpc".to_owned(),
)),
_ => {
Err(Error::InvalidConfig(format!("unsupported network: {}", x)))
}
_ => Err(Error::InvalidConfig(format!("unsupported network: {}", x))),
})
.transpose()?,
tls: match s.tls.unwrap_or_default() {
Expand All @@ -103,13 +101,10 @@ impl TryFrom<&OutboundVmess> for AnyOutboundHandler {
s.ws_opts
.as_ref()
.and_then(|x| {
x.headers
.as_ref()
.map(Clone::clone)
.and_then(|x| {
let h = x.get("Host");
h.map(Clone::clone)
})
x.headers.as_ref().map(Clone::clone).and_then(|x| {
let h = x.get("Host");
h.map(Clone::clone)
})
})
.unwrap_or(s.server.to_owned())
.to_owned(),
Expand Down
1 change: 0 additions & 1 deletion clash_lib/src/proxy/selector/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ impl SelectorControl for Handler {
}

async fn current(&self) -> String {

self.inner.read().await.current.to_owned()
}
}
Expand Down
6 changes: 1 addition & 5 deletions clash_lib/src/proxy/utils/provider_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ pub async fn get_proxies_from_providers(
provider.read().await.touch().await;
}

let mut proxies_from_provider = provider
.read()
.await
.proxies()
.await.to_vec();
let mut proxies_from_provider = provider.read().await.proxies().await.to_vec();
proxies.append(&mut proxies_from_provider);
}
proxies
Expand Down
4 changes: 1 addition & 3 deletions clash_lib/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,7 @@ impl Display for Session {
write!(
f,
"[{}] {} -> {}",
self.network,
self.source,
self.destination,
self.network, self.source, self.destination,
)
}
}
Expand Down

0 comments on commit 9980ab0

Please sign in to comment.