
801 S.W.2d 535 (1990)
Ex parte Eduardo M. BENAVIDES, Appellant.
No. 01-89-00935-CV.
Court of Appeals of Texas, Houston (1st Dist).
October 11, 1990.
Rehearing Denied December 6, 1990.
Eduardo Benavides, pro se.
Before DUNN, MIRABAL and SAM BASS, JJ.

OPINION
DUNN, Justice.
This is an appeal from a June 13, 1989. order dismissing appellant's, Eduardo M. Benavides's, pro se application for writ of habeas corpus.
Appellant is presently incarcerated in the Michael Unit of the Texas Department of Corrections, having been sentenced in cause no. 82-CR-2753 on June 5, 1984, to 33 years imprisonment.[1]
On October 31, 1988, appellant filed an application for writ of habeas corpus under TEX CONST, art. I, sees. 12 and 13 and TEX.CODE CRIM.P.ANN. arts. 1.08 and 11.01 (Vernon 1977), alleging that he is illegally restrained because:
(1) Dr. Watson of the Ellis 1 Unit issued him two cotton blankets in lieu of the standard wool blanket because appellant is allergic to wool; when appellant was moved to the Wynne Unit, Dr. Adams had the cotton blankets removed. Appellant asserts he cannot keep warm without cotton blankets, which aggravates his arthritis and asthma.

*536 (2) Retrieve Unit medical officials allowed appellant to have an extra pair of tennis shoes because of his flat feet; Wynne Unit officials removed the extra pair.
(3) He has been issued only Tylenol for his migraine headaches, which has not worked and adversely affects his asthma.
(4) He is assigned to a cell near the dayrooms, which are noisy in violation of health and safety standards.
(5) He is subject to repeated disciplinary charges because he refuses to work in his tennis shoes where safety shoes are required, and the medical authorities have failed to provide him with the special work shoes necessary for his flat feet.
(6) The authorities have refused to provide him with the TDC Health and Safety Manual, in violation of his open records request.
(7) Since July 14, 1988, the Wynne Unit has refused to allow appellant to work only a four-hour day, despite the instructions of John Sealy medical officials, following an injury to his knee on January 6, 1987. Retrieve Unit medical officials had placed restrictions on appellant's housing and work assignments consistent with his health limitations. Appellant has been placed in solitary confinement for refusing to work.
Appellant prayed for (1) a declaratory judgment that he was restrained in violation of his right to be free from cruel and unusual punishment as demonstrated by the above events, and (2) an injunction compelling L.H. Beaird, the warden, to correct the conditions complained of above. Appellant also filed an affidavit of poverty under Tex.R.Civ.P. 145(2), stating that he was an indigent state prisoner confined in the Texas Department of Corrections, unable to obtain legal counsel, and without any money or property to pay any cost of his action. Although the affidavit was not sworn before a notary public as required by Tex.R. Civ.P. 145(2), Tex.Civ.Prac. & Rem.Code Ann. § 13.001 (Vernon Supp.1990) provides that an inmate may use an unsworn declaration in lieu of a sworn affidavit, such as appellant used here.
The trial court set appellant's application for writ of habeas corpus for hearing under Tex.Civ.Prac. & Rem.Code Ann. § 13.001 (Vernon Supp.1990). A hearing was held on June 13, 1990. Appellant did not appear; the defendant, L.H. Beaird, was not served and did not appear; an assistant attorney general appeared as friend of the court. At the conclusion of the hearing, the trial court found the lawsuit frivolous under section 13.001 and dismissed it with prejudice. Appellant filed this appeal on July 3, 1989.
On appeal, appellant argues that (1) section 13.001 is unconstitutional because, as applied to article 11.01, it violates principles of due process and equal protection set forth in chapter 11 of the Texas Code of Criminal Procedure; because it deprived him of a remedy guaranteed by the Texas Constitution; because it applies only to indigent litigants and not non-indigent litigants and (2) the trial court abused its discretion in dismissing his action as frivolous.
Section 13.001 provides that when an affidavit of inability to pay under rule 145 has been filed, the court may dismiss the action if it finds the action is frivolous or malicious. Tex.Civ.Prac. & Rem.Code Ann. § 13.001(a)(2) (Vernon Supp.1990). In determining whether an action is frivolous, the court may consider whether: (1) the action's realistic chance of ultimate success is slight; (2) the claim has no arguable basis in law or in fact; or (3) it is clear the party cannot prove a set of facts in support of the claim. Tex.Civ.Prac. & Rem.Code Ann. § 13.001(b) (Vernon Supp.1990).
Section 13.001 was enacted in 1987. Our research reveals only one published case to date that construes section 13.001, Johnson v. Lynaugh, 766 S.W.2d 393 (Tex.App.-Tyler 1989, writ requested). In Johnson, an inmate sued the director of the Texas Department of Corrections, alleging violations of various constitutional rights. It was not a habeas corpus action, and did not attack the constitutionality of section 13.-001. The Tyler Court of Appeals held that *537 the trial court should be allowed broad discretion in determining whether a suit filed under rule 145 should be dismissed as frivolous under section 13.001. Id. at 394.
All statutes carry a presumption of validity. Vinson v. Burgess, 773 S.W.2d 263, 266 (Tex. 1989). We will not rule on the constitutionality of a statute unless necessary to decide a case in which the issue is raised. Smith v. State, 658 S.W.2d 172, 174 (Tex.Crim.App. 1983); Tolbert v. State, 697 S.W.2d 795, 797 (Tex.App.-Houston [1st Dist.] 1985), affd, 743 S.W.2d 631 (Tex.Crim.App.1988). In this case, it is not.
Article I, section 12 of the Texas Constitution provides that the writ of habeas corpus is a writ of right that can never be suspended. It empowers the legislature to enact laws to render habeas corpus speedy and effectual. Article 11.01 states:
The writ of habeas corpus is the remedy to be used when any person is restrained in his liberty. It is an order issued by a court or judge of competent jurisdiction, directed to any one having a person in his custody, or under his restraint, commanding him to produce such person, at a time and place named in the writ, and show why he is held in custody or under restraint.

TEX.CODE CRIM.PROC.ANN. art. 11.01 (Vernon 1977) (emphasis added.) Article 11.22 defines "restraint" as the kind of control that one person exercises over another, not to confine him within certain limits, but to subject him to the general authority and power of the person claiming such right. Tex.Code Crim.P.Ann. art. 11.22 (Vernon 1977).
The writ of habeas corpus is an extraordinary writ, and neither a trial court nor an appellate court, either in the exercise of original or appellate jurisdiction, should entertain an application for writ of habeas corpus where there is an adequate remedy at law. Ex parte Groves, 571 S.W.2d 888, 890 (Tex.Crim.App.1978). The writ of habeas corpus lies only where the applicant is actually restrained or deprived of liberty. Ex parte Beamer, 116 Tex. 39, 285 S.W. 255, 256 (1926). Furthermore, such restraint must be illegal for a writ of habeas corpus to be granted. See Ex parte Strother, 395 S.W.2d 629, 630 (Tex.Crim. App. 1965) (the conclusion that restraint is lawful precludes further consideration); Ex parte Rios, 385 S.W.2d 677, 678 (1965) (court is only authorized to inquire into the validity of the prisoner's confinement). A writ of habeas corpus is not available to secure determination of a question that, even if determined in the prisoner's favor, would not result in his immediate release. Ex parte Ruby, 403 S.W.2d 129, 130 (Tex. Crim.App.1966).
In the case before us, appellant does not challenge the legality of his confinement. Reading his application for writ of habeas corpus with "liberality and patience," we find that appellant is complaining of the terms and conditions of his confinement and acts of prison management. See Haines v. Kerner, 404 U.S. 519, 520, 92 S.Ct. 594, 595-96, 30 L.Ed.2d 652 (1972) (pro se complaints are held to a less stringent standard than formal pleadings drafted by attorneys); Johnson v. McAdams, 781 S.W.2d 451, 452 (Tex.App.-Houston [1st Dist.] 1989, orig. proceeding) (pro se applications should be reviewed with patience and liberality to determine complaints). We have been able to find no authority that would permit us to construe his complaints as a restraint for purposes of habeas corpus. Even though appellant may have pled facts entitling him to relief, he did not show any right to habeas corpus relief. See, e.g., Jackson v. Torres, 720 F.2d 877, 879 (5th Cir.1983) (a prisoner who attacks the fact or length of his confinement should seek habeas corpus relief even though the facts of his complaint may be sufficient to state a claim under 42 U.S.C. § 1983).
Because appellant is legally confined, and the record shows no illegal restraint for which habeas corpus relief may be granted to appellant, the trial court would not have erred had it denied appellant's application for writ of habeas corpus. Therefore, we cannot say that the trial court erred in dismissing appellant's application because it was frivolous.
*538 All points of error are overruled. The order of dismissal is affirmed.
NOTES
[1]  The record does not indicate in what court or for what offense appellant was convicted.
